-;;; outline.el --- outline mode commands for Emacs
+;;; outline.el --- outline mode commands for Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 1986, 1993-1995, 1997, 2000-2020 Free Software
;; Foundation, Inc.
;; Remove extra separator
(cdr
;; Flatten the major mode's menus into a single menu.
- (apply 'append
+ (apply #'append
(mapcar (lambda (x)
(if (consp x)
;; Add a separator between each
(defface outline-1
'((t :inherit font-lock-function-name-face))
- "Level 1."
- :group 'outlines)
+ "Level 1.")
(defface outline-2
'((t :inherit font-lock-variable-name-face))
- "Level 2."
- :group 'outlines)
+ "Level 2.")
(defface outline-3
'((t :inherit font-lock-keyword-face))
- "Level 3."
- :group 'outlines)
+ "Level 3.")
(defface outline-4
'((t :inherit font-lock-comment-face))
- "Level 4."
- :group 'outlines)
+ "Level 4.")
(defface outline-5
'((t :inherit font-lock-type-face))
- "Level 5."
- :group 'outlines)
+ "Level 5.")
(defface outline-6
'((t :inherit font-lock-constant-face))
- "Level 6."
- :group 'outlines)
+ "Level 6.")
(defface outline-7
'((t :inherit font-lock-builtin-face))
- "Level 7."
- :group 'outlines)
+ "Level 7.")
(defface outline-8
'((t :inherit font-lock-string-face))
- "Level 8."
- :group 'outlines)
+ "Level 8.")
(defvar outline-font-lock-faces
[outline-1 outline-2 outline-3 outline-4
outline-5 outline-6 outline-7 outline-8])
+\f
+(defvar outline-level #'outline-level
+ "Function of no args to compute a header's nesting level in an outline.
+It can assume point is at the beginning of a header line and that the match
+data reflects the `outline-regexp'.")
+;;;###autoload(put 'outline-level 'risky-local-variable t)
(defun outline-font-lock-face ()
"Return one of `outline-font-lock-faces' for current level."
Turning on outline mode calls the value of `text-mode-hook' and then of
`outline-mode-hook', if they are non-nil."
- (make-local-variable 'line-move-ignore-invisible)
- (setq line-move-ignore-invisible t)
+ (setq-local line-move-ignore-invisible t)
;; Cause use of ellipses for invisible text.
(add-to-invisibility-spec '(outline . t))
- (set (make-local-variable 'paragraph-start)
- (concat paragraph-start "\\|\\(?:" outline-regexp "\\)"))
+ (setq-local paragraph-start
+ (concat paragraph-start "\\|\\(?:" outline-regexp "\\)"))
;; Inhibit auto-filling of header lines.
- (set (make-local-variable 'auto-fill-inhibit-regexp) outline-regexp)
- (set (make-local-variable 'paragraph-separate)
- (concat paragraph-separate "\\|\\(?:" outline-regexp "\\)"))
- (set (make-local-variable 'font-lock-defaults)
- '(outline-font-lock-keywords t nil nil backward-paragraph))
- (setq imenu-generic-expression
- (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0)))
- (add-hook 'change-major-mode-hook 'outline-show-all nil t))
+ (setq-local auto-fill-inhibit-regexp outline-regexp)
+ (setq-local paragraph-separate
+ (concat paragraph-separate "\\|\\(?:" outline-regexp "\\)"))
+ (setq-local font-lock-defaults
+ '(outline-font-lock-keywords t nil nil backward-paragraph))
+ (setq-local imenu-generic-expression
+ (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0)))
+ (add-hook 'change-major-mode-hook #'outline-show-all nil t))
(defvar outline-minor-mode-map)
The value of this variable is checked as part of loading Outline mode.
After that, changing the prefix key requires manipulating keymaps."
:type 'key-sequence
- :group 'outlines
:initialize 'custom-initialize-default
:set (lambda (sym val)
(define-key outline-minor-mode-map outline-minor-mode-prefix nil)
See the command `outline-mode' for more information on this mode."
nil " Outl" (list (cons [menu-bar] outline-minor-mode-menu-bar-map)
(cons outline-minor-mode-prefix outline-mode-prefix-map))
- :group 'outlines
(if outline-minor-mode
(progn
;; Turn off this mode if we change major modes.
(remove-from-invisibility-spec '(outline . t))
;; When turning off outline mode, get rid of any outline hiding.
(outline-show-all)))
-\f
-(defvar outline-level 'outline-level
- "Function of no args to compute a header's nesting level in an outline.
-It can assume point is at the beginning of a header line and that the match
-data reflects the `outline-regexp'.")
-;;;###autoload(put 'outline-level 'risky-local-variable t)
-(defvar outline-heading-alist ()
+(defvar-local outline-heading-alist ()
"Alist associating a heading for every possible level.
Each entry is of the form (HEADING . LEVEL).
This alist is used two ways: to find the heading corresponding to
Instead of sorting the entries in each set, you can also separate the
sets with nil.")
-(make-variable-buffer-local 'outline-heading-alist)
;; This used to count columns rather than characters, but that made ^L
;; appear to be at level 2 instead of 1. Columns would be better for
(if current-prefix-arg nil 'subtree))))
(cond
((eq which 'region)
- (outline-map-region 'outline-promote (region-beginning) (region-end)))
+ (outline-map-region #'outline-promote (region-beginning) (region-end)))
(which
- (outline-map-region 'outline-promote
+ (outline-map-region #'outline-promote
(point)
(save-excursion (outline-get-next-sibling) (point))))
(t
(if current-prefix-arg nil 'subtree))))
(cond
((eq which 'region)
- (outline-map-region 'outline-demote (region-beginning) (region-end)))
+ (outline-map-region #'outline-demote (region-beginning) (region-end)))
(which
- (outline-map-region 'outline-demote
+ (outline-map-region #'outline-demote
(point)
(save-excursion (outline-get-next-sibling) (point))))
(t
(goto-char beg)))
\f
-(defvar outline-isearch-open-invisible-function nil
+(defvar outline-isearch-open-invisible-function
+ #'outline-isearch-open-invisible
"Function called if `isearch' finishes in an invisible overlay.
-The function is called with the overlay as its only argument.
-If nil, `outline-show-entry' is called to reveal the invisible text.")
+The function is called with the overlay as its only argument.")
-(put 'outline 'reveal-toggle-invisible 'outline-reveal-toggle-invisible)
+(put 'outline 'reveal-toggle-invisible #'outline-reveal-toggle-invisible)
(defun outline-flag-region (from to flag)
"Hide or show lines from FROM to TO, according to FLAG.
If FLAG is nil then text is shown, while if FLAG is t the text is hidden."
(overlay-put o 'invisible 'outline)
(overlay-put o 'isearch-open-invisible
(or outline-isearch-open-invisible-function
- 'outline-isearch-open-invisible))))
+ #'outline-isearch-open-invisible))))
;; Seems only used by lazy-lock. I.e. obsolete.
(run-hooks 'outline-view-change-hook))
(outline-end-of-heading)
(outline-flag-region (point) (progn (outline-next-preface) (point)) t)))
-(define-obsolete-function-alias
- 'hide-entry 'outline-hide-entry "25.1")
+(define-obsolete-function-alias 'hide-entry #'outline-hide-entry "25.1")
(defun outline-show-entry ()
"Show the body directly following this heading.
(point)))
nil)))
-(define-obsolete-function-alias
- 'show-entry 'outline-show-entry "25.1")
+(define-obsolete-function-alias 'show-entry #'outline-show-entry "25.1")
(defun outline-hide-body ()
"Hide all body lines in buffer, leaving all headings visible.
(interactive)
(outline-hide-region-body (point-min) (point-max)))
-(define-obsolete-function-alias
- 'hide-body 'outline-hide-body "25.1")
+(define-obsolete-function-alias 'hide-body #'outline-hide-body "25.1")
(defun outline-hide-region-body (start end)
"Hide all body lines between START and END, but not headings."
(run-hooks 'outline-view-change-hook))
(define-obsolete-function-alias
- 'hide-region-body 'outline-hide-region-body "25.1")
+ 'hide-region-body #'outline-hide-region-body "25.1")
(defun outline-show-all ()
"Show all of the text in the buffer."
(interactive)
(outline-flag-region (point-min) (point-max) nil))
-(define-obsolete-function-alias
- 'show-all 'outline-show-all "25.1")
+(define-obsolete-function-alias 'show-all #'outline-show-all "25.1")
(defun outline-hide-subtree ()
"Hide everything after this heading at deeper levels."
(interactive)
(outline-flag-subtree t))
-(define-obsolete-function-alias
- 'hide-subtree 'outline-hide-subtree "25.1")
+(define-obsolete-function-alias 'hide-subtree #'outline-hide-subtree "25.1")
(defun outline-hide-leaves ()
"Hide the body after this heading and at deeper levels."
(point)
(progn (outline-end-of-subtree) (point)))))
-(define-obsolete-function-alias
- 'hide-leaves 'outline-hide-leaves "25.1")
+(define-obsolete-function-alias 'hide-leaves #'outline-hide-leaves "25.1")
(defun outline-show-subtree ()
"Show everything after this heading at deeper levels."
(interactive)
(outline-flag-subtree nil))
-(define-obsolete-function-alias
- 'show-subtree 'outline-show-subtree "25.1")
+(define-obsolete-function-alias 'show-subtree #'outline-show-subtree "25.1")
(defun outline-show-heading ()
"Show the current heading and move to its end."
(outline-flag-region (1- (point)) (point) nil))))
(run-hooks 'outline-view-change-hook))
-(define-obsolete-function-alias
- 'hide-sublevels 'outline-hide-sublevels "25.1")
+(define-obsolete-function-alias 'hide-sublevels #'outline-hide-sublevels "25.1")
(defun outline-hide-other ()
"Hide everything except current body and parent and top-level headings.
nil))))
(run-hooks 'outline-view-change-hook))
-(define-obsolete-function-alias
- 'hide-other 'outline-hide-other "25.1")
+(define-obsolete-function-alias 'hide-other #'outline-hide-other "25.1")
(defun outline-toggle-children ()
"Show or hide the current subtree depending on its current state."
(interactive)
(outline-show-children 1000))
-(define-obsolete-function-alias
- 'show-branches 'outline-show-branches "25.1")
+(define-obsolete-function-alias 'show-branches #'outline-show-branches "25.1")
(defun outline-show-children (&optional level)
"Show all direct subheadings of this heading.
(if (eobp) (point-max) (1+ (point)))))))
(run-hooks 'outline-view-change-hook))
-(define-obsolete-function-alias
- 'show-children 'outline-show-children "25.1")
+(define-obsolete-function-alias 'show-children #'outline-show-children "25.1")
\f