Variable: outline-minor-mode

outline-minor-mode is a buffer-local variable defined in outline.el.gz.

Documentation

Non-nil if Outline minor mode is enabled.

Use the command outline-minor-mode(var)/outline-minor-mode(fun) to change this variable.

View in manual

Probably introduced at or before Emacs version 19.20.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/outline.el.gz
;;;###autoload
(define-minor-mode outline-minor-mode
  "Toggle Outline minor mode.

See the command `outline-mode' for more information on this mode."
  :lighter " Outl"
  :keymap (define-keymap
            :parent outline-minor-mode-cycle-map
            "<menu-bar>" outline-minor-mode-menu-bar-map
            (key-description outline-minor-mode-prefix) outline-mode-prefix-map)
  (if outline-minor-mode
      (progn
        (when outline-minor-mode-use-buttons
          (add-hook 'after-change-functions
                    #'outline--fix-buttons-after-change nil t)
          (when (eq (current-bidi-paragraph-direction) 'right-to-left)
            (setq-local outline--use-rtl t))
          (setq-local outline--button-icons (outline--create-button-icons))
          (when (and (eq outline-minor-mode-use-buttons 'in-margins)
                     (> 1 (if outline--use-rtl right-margin-width
                            left-margin-width)))
            (setq outline--margin-width
                  (or outline-margin-width
                      (ceiling
                       (/ (seq-max
                           (seq-map #'string-pixel-width
                                    (seq-map #'icon-string
                                             `(outline-open-in-margins
                                               ,(if outline--use-rtl
                                                    'outline-close-rtl-in-margins
                                                  'outline-close-in-margins)))))
                          (* (default-font-width) 1.0)))))
            (if outline--use-rtl
                (setq-local right-margin-width (+ right-margin-width
                                                  outline--margin-width))
              (setq-local left-margin-width (+ left-margin-width
                                               outline--margin-width)))
            (setq-local fringes-outside-margins t)
            ;; Force display of margins
            (when (eq (current-buffer) (window-buffer))
              (set-window-buffer nil (window-buffer)))))
        (when outline-minor-mode-highlight
          (if (and global-font-lock-mode (font-lock-specified-p major-mode))
              (progn
                (font-lock-add-keywords nil outline-font-lock-keywords t)
                (font-lock-flush))
            (progn
              (outline-minor-mode-highlight-buffer)
              (add-hook 'revert-buffer-restore-functions
                        #'outline-revert-buffer-rehighlight nil t))))
        (outline--fix-up-all-buttons)
	;; Turn off this mode if we change major modes.
	(add-hook 'change-major-mode-hook
		  (lambda () (outline-minor-mode -1))
		  nil t)
        (add-hook 'revert-buffer-restore-functions
                  #'outline-revert-buffer-restore-visibility nil t)
        (setq-local line-move-ignore-invisible t)
	;; Cause use of ellipses for invisible text.
	(add-to-invisibility-spec '(outline . t))
	(outline-apply-default-state))
    (remove-hook 'after-change-functions
                 #'outline--fix-buttons-after-change t)
    (remove-hook 'revert-buffer-restore-functions
                 #'outline-revert-buffer-restore-visibility t)
    (remove-hook 'revert-buffer-restore-functions
                 #'outline-revert-buffer-rehighlight t)
    (setq line-move-ignore-invisible nil)
    ;; Cause use of ellipses for invisible text.
    (remove-from-invisibility-spec '(outline . t))
    ;; When turning off outline mode, get rid of any outline hiding.
    (outline-show-all)
    (when outline-minor-mode-highlight
      (if font-lock-fontified
          (font-lock-remove-keywords nil outline-font-lock-keywords))
      (font-lock-flush)
      (remove-overlays nil nil 'outline-highlight t))
    (when outline-minor-mode-use-buttons
      (remove-overlays nil nil 'outline-button t)
      (when (and (eq outline-minor-mode-use-buttons 'in-margins)
                 (< 0 (if outline--use-rtl right-margin-width
                        left-margin-width)))
        (if outline--use-rtl
            (setq-local right-margin-width (- right-margin-width
                                              outline--margin-width))
          (setq-local left-margin-width (- left-margin-width
                                           outline--margin-width)))
        (setq-local fringes-outside-margins nil)
        ;; Force removal of margins
        (when (eq (current-buffer) (window-buffer))
          (set-window-buffer nil (window-buffer)))))))