diff options
| author | Oleh Krehel | 2015-01-28 10:32:12 +0100 |
|---|---|---|
| committer | Oleh Krehel | 2015-01-30 17:44:03 +0100 |
| commit | ac79251493318468162c93b46fe066f6bd7bd328 (patch) | |
| tree | fbccd6eba63b0dd98ef87ffe485a3a25fd4b838b | |
| parent | 5a1b8a1179829e9c2aefb3e430a3d99cdbad4099 (diff) | |
| download | emacs-ac79251493318468162c93b46fe066f6bd7bd328.tar.gz emacs-ac79251493318468162c93b46fe066f6bd7bd328.zip | |
lisp/outline.el: Add namespace prefixes.
* outline.el (outline-hide-entry): Rename from `hide-entry'.
(outline-show-entry): rename from `show-entry'
(outline-hide-body): Rename from `hide-body'.
(outline-hide-region-body): Rename from `hide-region-body'.
(outline-show-all): Rename from `show-all'.
(outline-hide-subtree): Rename from `hide-subtree'.
(outline-hide-leaves): Rename from `hide-leaves'.
(outline-show-subtree): Rename from `show-subtree'.
(outline-hide-sublevels): Rename from `hide-sublevels'.
(outline-hide-other): Rename from `hide-other'.
(outline-show-children): Rename from `show-children'.
(outline-show-branches): Rename from `show-branches'.
| -rw-r--r-- | lisp/ChangeLog | 27 | ||||
| -rw-r--r-- | lisp/outline.el | 238 |
2 files changed, 160 insertions, 105 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 511bb869c3e..e05774f79dd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,32 @@ | |||
| 1 | 2015-01-30 Oleh Krehel <ohwoeowho@gmail.com> | 1 | 2015-01-30 Oleh Krehel <ohwoeowho@gmail.com> |
| 2 | 2 | ||
| 3 | * outline.el (outline-hide-entry): Rename from `hide-entry'. | ||
| 4 | (hide-entry): Declare as obsolete. | ||
| 5 | (outline-show-entry): Rename from `show-entry'. | ||
| 6 | (show-entry): Declare as obsolete. | ||
| 7 | (outline-hide-body): Rename from `hide-body'. | ||
| 8 | (hide-body): Declare as obsolete. | ||
| 9 | (outline-hide-region-body): Rename from `hide-region-body'. | ||
| 10 | (hide-region-body): Declare as obsolete. | ||
| 11 | (outline-show-all): Rename from `show-all'. | ||
| 12 | (show-all): Declare as obsolete. | ||
| 13 | (outline-hide-subtree): Rename from `hide-subtree'. | ||
| 14 | (hide-subtree): Declare as obsolete. | ||
| 15 | (outline-hide-leaves): Rename from `hide-leaves'. | ||
| 16 | (hide-leaves): Declare as obsolete. | ||
| 17 | (outline-show-subtree): Rename from `show-subtree'. | ||
| 18 | (show-subtree): Declare as obsolete. | ||
| 19 | (outline-hide-sublevels): Rename from `hide-sublevels'. | ||
| 20 | (hide-sublevels): Declare as obsolete. | ||
| 21 | (outline-hide-other): Rename from `hide-other'. | ||
| 22 | (hide-other): Declare as obsolete. | ||
| 23 | (outline-show-children): Rename from `show-children'. | ||
| 24 | (show-children): Declare as obsolete. | ||
| 25 | (outline-show-branches): Rename from `show-branches'. | ||
| 26 | (show-branches): Declare as obsolete. | ||
| 27 | |||
| 28 | 2015-01-30 Oleh Krehel <ohwoeowho@gmail.com> | ||
| 29 | |||
| 3 | * outline.el (outline-mode): Clean up docstring. | 30 | * outline.el (outline-mode): Clean up docstring. |
| 4 | (font-lock-warning-face): Remove obsolete declaration. | 31 | (font-lock-warning-face): Remove obsolete declaration. |
| 5 | (outline-font-lock-face): Remove obsolete comment. | 32 | (outline-font-lock-face): Remove obsolete comment. |
diff --git a/lisp/outline.el b/lisp/outline.el index 1f52998ef6b..d8c49b312a8 100644 --- a/lisp/outline.el +++ b/lisp/outline.el | |||
| @@ -62,20 +62,20 @@ in the file it applies to.") | |||
| 62 | (define-key map "@" 'outline-mark-subtree) | 62 | (define-key map "@" 'outline-mark-subtree) |
| 63 | (define-key map "\C-n" 'outline-next-visible-heading) | 63 | (define-key map "\C-n" 'outline-next-visible-heading) |
| 64 | (define-key map "\C-p" 'outline-previous-visible-heading) | 64 | (define-key map "\C-p" 'outline-previous-visible-heading) |
| 65 | (define-key map "\C-i" 'show-children) | 65 | (define-key map "\C-i" 'outline-show-children) |
| 66 | (define-key map "\C-s" 'show-subtree) | 66 | (define-key map "\C-s" 'outline-show-subtree) |
| 67 | (define-key map "\C-d" 'hide-subtree) | 67 | (define-key map "\C-d" 'outline-hide-subtree) |
| 68 | (define-key map "\C-u" 'outline-up-heading) | 68 | (define-key map "\C-u" 'outline-up-heading) |
| 69 | (define-key map "\C-f" 'outline-forward-same-level) | 69 | (define-key map "\C-f" 'outline-forward-same-level) |
| 70 | (define-key map "\C-b" 'outline-backward-same-level) | 70 | (define-key map "\C-b" 'outline-backward-same-level) |
| 71 | (define-key map "\C-t" 'hide-body) | 71 | (define-key map "\C-t" 'outline-hide-body) |
| 72 | (define-key map "\C-a" 'show-all) | 72 | (define-key map "\C-a" 'outline-show-all) |
| 73 | (define-key map "\C-c" 'hide-entry) | 73 | (define-key map "\C-c" 'outline-hide-entry) |
| 74 | (define-key map "\C-e" 'show-entry) | 74 | (define-key map "\C-e" 'outline-show-entry) |
| 75 | (define-key map "\C-l" 'hide-leaves) | 75 | (define-key map "\C-l" 'outline-hide-leaves) |
| 76 | (define-key map "\C-k" 'show-branches) | 76 | (define-key map "\C-k" 'outline-show-branches) |
| 77 | (define-key map "\C-q" 'hide-sublevels) | 77 | (define-key map "\C-q" 'outline-hide-sublevels) |
| 78 | (define-key map "\C-o" 'hide-other) | 78 | (define-key map "\C-o" 'outline-hide-other) |
| 79 | (define-key map "\C-^" 'outline-move-subtree-up) | 79 | (define-key map "\C-^" 'outline-move-subtree-up) |
| 80 | (define-key map "\C-v" 'outline-move-subtree-down) | 80 | (define-key map "\C-v" 'outline-move-subtree-down) |
| 81 | (define-key map [(control ?<)] 'outline-promote) | 81 | (define-key map [(control ?<)] 'outline-promote) |
| @@ -85,49 +85,43 @@ in the file it applies to.") | |||
| 85 | 85 | ||
| 86 | (defvar outline-mode-menu-bar-map | 86 | (defvar outline-mode-menu-bar-map |
| 87 | (let ((map (make-sparse-keymap))) | 87 | (let ((map (make-sparse-keymap))) |
| 88 | |||
| 89 | (define-key map [hide] (cons "Hide" (make-sparse-keymap "Hide"))) | 88 | (define-key map [hide] (cons "Hide" (make-sparse-keymap "Hide"))) |
| 90 | 89 | (define-key map [hide outline-hide-other] | |
| 91 | (define-key map [hide hide-other] | 90 | '(menu-item "Hide Other" outline-hide-other |
| 92 | '(menu-item "Hide Other" hide-other | ||
| 93 | :help "Hide everything except current body and parent and top-level headings")) | 91 | :help "Hide everything except current body and parent and top-level headings")) |
| 94 | (define-key map [hide hide-sublevels] | 92 | (define-key map [hide outline-hide-sublevels] |
| 95 | '(menu-item "Hide Sublevels" hide-sublevels | 93 | '(menu-item "Hide Sublevels" outline-hide-sublevels |
| 96 | :help "Hide everything but the top LEVELS levels of headers, in whole buffer")) | 94 | :help "Hide everything but the top LEVELS levels of headers, in whole buffer")) |
| 97 | (define-key map [hide hide-subtree] | 95 | (define-key map [hide outline-hide-subtree] |
| 98 | '(menu-item "Hide Subtree" hide-subtree | 96 | '(menu-item "Hide Subtree" outline-hide-subtree |
| 99 | :help "Hide everything after this heading at deeper levels")) | 97 | :help "Hide everything after this heading at deeper levels")) |
| 100 | (define-key map [hide hide-entry] | 98 | (define-key map [hide outline-hide-entry] |
| 101 | '(menu-item "Hide Entry" hide-entry | 99 | '(menu-item "Hide Entry" outline-hide-entry |
| 102 | :help "Hide the body directly following this heading")) | 100 | :help "Hide the body directly following this heading")) |
| 103 | (define-key map [hide hide-body] | 101 | (define-key map [hide outline-hide-body] |
| 104 | '(menu-item "Hide Body" hide-body | 102 | '(menu-item "Hide Body" outline-hide-body |
| 105 | :help "Hide all body lines in buffer, leaving all headings visible")) | 103 | :help "Hide all body lines in buffer, leaving all headings visible")) |
| 106 | (define-key map [hide hide-leaves] | 104 | (define-key map [hide outline-hide-leaves] |
| 107 | '(menu-item "Hide Leaves" hide-leaves | 105 | '(menu-item "Hide Leaves" outline-hide-leaves |
| 108 | :help "Hide the body after this heading and at deeper levels")) | 106 | :help "Hide the body after this heading and at deeper levels")) |
| 109 | |||
| 110 | (define-key map [show] (cons "Show" (make-sparse-keymap "Show"))) | 107 | (define-key map [show] (cons "Show" (make-sparse-keymap "Show"))) |
| 111 | 108 | (define-key map [show outline-show-subtree] | |
| 112 | (define-key map [show show-subtree] | 109 | '(menu-item "Show Subtree" outline-show-subtree |
| 113 | '(menu-item "Show Subtree" show-subtree | ||
| 114 | :help "Show everything after this heading at deeper levels")) | 110 | :help "Show everything after this heading at deeper levels")) |
| 115 | (define-key map [show show-children] | 111 | (define-key map [show outline-show-children] |
| 116 | '(menu-item "Show Children" show-children | 112 | '(menu-item "Show Children" outline-show-children |
| 117 | :help "Show all direct subheadings of this heading")) | 113 | :help "Show all direct subheadings of this heading")) |
| 118 | (define-key map [show show-branches] | 114 | (define-key map [show outline-show-branches] |
| 119 | '(menu-item "Show Branches" show-branches | 115 | '(menu-item "Show Branches" outline-show-branches |
| 120 | :help "Show all subheadings of this heading, but not their bodies")) | 116 | :help "Show all subheadings of this heading, but not their bodies")) |
| 121 | (define-key map [show show-entry] | 117 | (define-key map [show outline-show-entry] |
| 122 | '(menu-item "Show Entry" show-entry | 118 | '(menu-item "Show Entry" outline-show-entry |
| 123 | :help "Show the body directly following this heading")) | 119 | :help "Show the body directly following this heading")) |
| 124 | (define-key map [show show-all] | 120 | (define-key map [show outline-show-all] |
| 125 | '(menu-item "Show All" show-all | 121 | '(menu-item "Show All" outline-show-all |
| 126 | :help "Show all of the text in the buffer")) | 122 | :help "Show all of the text in the buffer")) |
| 127 | |||
| 128 | (define-key map [headings] | 123 | (define-key map [headings] |
| 129 | (cons "Headings" (make-sparse-keymap "Headings"))) | 124 | (cons "Headings" (make-sparse-keymap "Headings"))) |
| 130 | |||
| 131 | (define-key map [headings demote-subtree] | 125 | (define-key map [headings demote-subtree] |
| 132 | '(menu-item "Demote Subtree" outline-demote | 126 | '(menu-item "Demote Subtree" outline-demote |
| 133 | :help "Demote headings lower down the tree")) | 127 | :help "Demote headings lower down the tree")) |
| @@ -148,23 +142,18 @@ in the file it applies to.") | |||
| 148 | '(menu-item "New Heading" outline-insert-heading | 142 | '(menu-item "New Heading" outline-insert-heading |
| 149 | :help "Insert a new heading at same depth at point")) | 143 | :help "Insert a new heading at same depth at point")) |
| 150 | (define-key map [headings outline-backward-same-level] | 144 | (define-key map [headings outline-backward-same-level] |
| 151 | |||
| 152 | '(menu-item "Previous Same Level" outline-backward-same-level | 145 | '(menu-item "Previous Same Level" outline-backward-same-level |
| 153 | :help "Move backward to the arg'th subheading at same level as this one.")) | 146 | :help "Move backward to the arg'th subheading at same level as this one.")) |
| 154 | (define-key map [headings outline-forward-same-level] | 147 | (define-key map [headings outline-forward-same-level] |
| 155 | |||
| 156 | '(menu-item "Next Same Level" outline-forward-same-level | 148 | '(menu-item "Next Same Level" outline-forward-same-level |
| 157 | :help "Move forward to the arg'th subheading at same level as this one")) | 149 | :help "Move forward to the arg'th subheading at same level as this one")) |
| 158 | (define-key map [headings outline-previous-visible-heading] | 150 | (define-key map [headings outline-previous-visible-heading] |
| 159 | |||
| 160 | '(menu-item "Previous" outline-previous-visible-heading | 151 | '(menu-item "Previous" outline-previous-visible-heading |
| 161 | :help "Move to the previous heading line")) | 152 | :help "Move to the previous heading line")) |
| 162 | (define-key map [headings outline-next-visible-heading] | 153 | (define-key map [headings outline-next-visible-heading] |
| 163 | |||
| 164 | '(menu-item "Next" outline-next-visible-heading | 154 | '(menu-item "Next" outline-next-visible-heading |
| 165 | :help "Move to the next visible heading line")) | 155 | :help "Move to the next visible heading line")) |
| 166 | (define-key map [headings outline-up-heading] | 156 | (define-key map [headings outline-up-heading] |
| 167 | |||
| 168 | '(menu-item "Up" outline-up-heading | 157 | '(menu-item "Up" outline-up-heading |
| 169 | :help "Move to the visible heading line of which the present line is a subheading")) | 158 | :help "Move to the visible heading line of which the present line is a subheading")) |
| 170 | map)) | 159 | map)) |
| @@ -272,8 +261,9 @@ of the heading, so they move with it, if the line is killed and yanked | |||
| 272 | back. A heading with text hidden under it is marked with an ellipsis (...). | 261 | back. A heading with text hidden under it is marked with an ellipsis (...). |
| 273 | 262 | ||
| 274 | \\{outline-mode-map} | 263 | \\{outline-mode-map} |
| 275 | The commands `hide-subtree', `show-subtree', `show-children', | 264 | The commands `outline-hide-subtree', `outline-show-subtree', |
| 276 | `hide-entry', `show-entry', `hide-leaves', and `show-branches' | 265 | `outline-show-children', `outline-hide-entry', |
| 266 | `outline-show-entry', `outline-hide-leaves', and `outline-show-branches' | ||
| 277 | are used when point is on a heading line. | 267 | are used when point is on a heading line. |
| 278 | 268 | ||
| 279 | The variable `outline-regexp' can be changed to control what is a heading. | 269 | The variable `outline-regexp' can be changed to control what is a heading. |
| @@ -296,7 +286,7 @@ Turning on outline mode calls the value of `text-mode-hook' and then of | |||
| 296 | '(outline-font-lock-keywords t nil nil backward-paragraph)) | 286 | '(outline-font-lock-keywords t nil nil backward-paragraph)) |
| 297 | (setq imenu-generic-expression | 287 | (setq imenu-generic-expression |
| 298 | (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))) | 288 | (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))) |
| 299 | (add-hook 'change-major-mode-hook 'show-all nil t)) | 289 | (add-hook 'change-major-mode-hook 'outline-show-all nil t)) |
| 300 | 290 | ||
| 301 | (defcustom outline-minor-mode-prefix "\C-c@" | 291 | (defcustom outline-minor-mode-prefix "\C-c@" |
| 302 | "Prefix key to use for Outline commands in Outline minor mode. | 292 | "Prefix key to use for Outline commands in Outline minor mode. |
| @@ -329,7 +319,7 @@ See the command `outline-mode' for more information on this mode." | |||
| 329 | ;; Cause use of ellipses for invisible text. | 319 | ;; Cause use of ellipses for invisible text. |
| 330 | (remove-from-invisibility-spec '(outline . t)) | 320 | (remove-from-invisibility-spec '(outline . t)) |
| 331 | ;; When turning off outline mode, get rid of any outline hiding. | 321 | ;; When turning off outline mode, get rid of any outline hiding. |
| 332 | (show-all))) | 322 | (outline-show-all))) |
| 333 | 323 | ||
| 334 | (defvar outline-level 'outline-level | 324 | (defvar outline-level 'outline-level |
| 335 | "Function of no args to compute a header's nesting level in an outline. | 325 | "Function of no args to compute a header's nesting level in an outline. |
| @@ -633,7 +623,7 @@ the match data is set appropriately." | |||
| 633 | (move-marker ins-point (point)) | 623 | (move-marker ins-point (point)) |
| 634 | (insert (delete-and-extract-region beg end)) | 624 | (insert (delete-and-extract-region beg end)) |
| 635 | (goto-char ins-point) | 625 | (goto-char ins-point) |
| 636 | (if folded (hide-subtree)) | 626 | (if folded (outline-hide-subtree)) |
| 637 | (move-marker ins-point nil))) | 627 | (move-marker ins-point nil))) |
| 638 | 628 | ||
| 639 | (defun outline-end-of-heading () | 629 | (defun outline-end-of-heading () |
| @@ -695,7 +685,7 @@ This puts point at the start of the current subtree, and mark at the end." | |||
| 695 | (defvar outline-isearch-open-invisible-function nil | 685 | (defvar outline-isearch-open-invisible-function nil |
| 696 | "Function called if `isearch' finishes in an invisible overlay. | 686 | "Function called if `isearch' finishes in an invisible overlay. |
| 697 | The function is called with the overlay as its only argument. | 687 | The function is called with the overlay as its only argument. |
| 698 | If nil, `show-entry' is called to reveal the invisible text.") | 688 | If nil, `outline-show-entry' is called to reveal the invisible text.") |
| 699 | 689 | ||
| 700 | (put 'outline 'reveal-toggle-invisible 'outline-reveal-toggle-invisible) | 690 | (put 'outline 'reveal-toggle-invisible 'outline-reveal-toggle-invisible) |
| 701 | (defun outline-flag-region (from to flag) | 691 | (defun outline-flag-region (from to flag) |
| @@ -719,51 +709,51 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | |||
| 719 | (save-excursion | 709 | (save-excursion |
| 720 | (goto-char (overlay-start o)) | 710 | (goto-char (overlay-start o)) |
| 721 | (if hidep | 711 | (if hidep |
| 722 | ;; When hiding the area again, we could just clean it up and let | 712 | ;; When hiding the area again, we could just clean it up and let |
| 723 | ;; reveal do the rest, by simply doing: | 713 | ;; reveal do the rest, by simply doing: |
| 724 | ;; (remove-overlays (overlay-start o) (overlay-end o) | 714 | ;; (remove-overlays (overlay-start o) (overlay-end o) |
| 725 | ;; 'invisible 'outline) | 715 | ;; 'invisible 'outline) |
| 726 | ;; | 716 | ;; |
| 727 | ;; That works fine as long as everything is in sync, but if the | 717 | ;; That works fine as long as everything is in sync, but if the |
| 728 | ;; structure of the document is changed while revealing parts of it, | 718 | ;; structure of the document is changed while revealing parts of it, |
| 729 | ;; the resulting behavior can be ugly. I.e. we need to make | 719 | ;; the resulting behavior can be ugly. I.e. we need to make |
| 730 | ;; sure that we hide exactly a subtree. | 720 | ;; sure that we hide exactly a subtree. |
| 731 | (progn | 721 | (progn |
| 732 | (let ((end (overlay-end o))) | 722 | (let ((end (overlay-end o))) |
| 733 | (delete-overlay o) | 723 | (delete-overlay o) |
| 734 | (while (progn | 724 | (while (progn |
| 735 | (hide-subtree) | 725 | (outline-hide-subtree) |
| 736 | (outline-next-visible-heading 1) | 726 | (outline-next-visible-heading 1) |
| 737 | (and (not (eobp)) (< (point) end)))))) | 727 | (and (not (eobp)) (< (point) end)))))) |
| 738 | 728 | ||
| 739 | ;; When revealing, we just need to reveal sublevels. If point is | 729 | ;; When revealing, we just need to reveal sublevels. If point is |
| 740 | ;; inside one of the sublevels, reveal will call us again. | 730 | ;; inside one of the sublevels, reveal will call us again. |
| 741 | ;; But we need to preserve the original overlay. | 731 | ;; But we need to preserve the original overlay. |
| 742 | (let ((o1 (copy-overlay o))) | 732 | (let ((o1 (copy-overlay o))) |
| 743 | (overlay-put o 'invisible nil) ;Show (most of) the text. | 733 | (overlay-put o 'invisible nil) ;Show (most of) the text. |
| 744 | (while (progn | 734 | (while (progn |
| 745 | (show-entry) | 735 | (outline-show-entry) |
| 746 | (show-children) | 736 | (outline-show-children) |
| 747 | ;; Normally just the above is needed. | 737 | ;; Normally just the above is needed. |
| 748 | ;; But in odd cases, the above might fail to show anything. | 738 | ;; But in odd cases, the above might fail to show anything. |
| 749 | ;; To avoid an infinite loop, we have to make sure that | 739 | ;; To avoid an infinite loop, we have to make sure that |
| 750 | ;; *something* gets shown. | 740 | ;; *something* gets shown. |
| 751 | (and (equal (overlay-start o) (overlay-start o1)) | 741 | (and (equal (overlay-start o) (overlay-start o1)) |
| 752 | (< (point) (overlay-end o)) | 742 | (< (point) (overlay-end o)) |
| 753 | (= 0 (forward-line 1))))) | 743 | (= 0 (forward-line 1))))) |
| 754 | ;; If still nothing was shown, just kill the damn thing. | 744 | ;; If still nothing was shown, just kill the damn thing. |
| 755 | (when (equal (overlay-start o) (overlay-start o1)) | 745 | (when (equal (overlay-start o) (overlay-start o1)) |
| 756 | ;; I've seen it happen at the end of buffer. | 746 | ;; I've seen it happen at the end of buffer. |
| 757 | (delete-overlay o1)))))) | 747 | (delete-overlay o1)))))) |
| 758 | 748 | ||
| 759 | ;; Function to be set as an outline-isearch-open-invisible' property | 749 | ;; Function to be set as an outline-isearch-open-invisible' property |
| 760 | ;; to the overlay that makes the outline invisible (see | 750 | ;; to the overlay that makes the outline invisible (see |
| 761 | ;; `outline-flag-region'). | 751 | ;; `outline-flag-region'). |
| 762 | (defun outline-isearch-open-invisible (_overlay) | 752 | (defun outline-isearch-open-invisible (_overlay) |
| 763 | ;; We rely on the fact that isearch places point on the matched text. | 753 | ;; We rely on the fact that isearch places point on the matched text. |
| 764 | (show-entry)) | 754 | (outline-show-entry)) |
| 765 | 755 | ||
| 766 | (defun hide-entry () | 756 | (defun outline-hide-entry () |
| 767 | "Hide the body directly following this heading." | 757 | "Hide the body directly following this heading." |
| 768 | (interactive) | 758 | (interactive) |
| 769 | (save-excursion | 759 | (save-excursion |
| @@ -771,21 +761,30 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | |||
| 771 | (outline-end-of-heading) | 761 | (outline-end-of-heading) |
| 772 | (outline-flag-region (point) (progn (outline-next-preface) (point)) t))) | 762 | (outline-flag-region (point) (progn (outline-next-preface) (point)) t))) |
| 773 | 763 | ||
| 774 | (defun show-entry () | 764 | (define-obsolete-function-alias |
| 765 | 'hide-entry 'outline-hide-entry "25.1") | ||
| 766 | |||
| 767 | (defun outline-show-entry () | ||
| 775 | "Show the body directly following this heading. | 768 | "Show the body directly following this heading. |
| 776 | Show the heading too, if it is currently invisible." | 769 | Show the heading too, if it is currently invisible." |
| 777 | (interactive) | 770 | (interactive) |
| 778 | (save-excursion | 771 | (save-excursion |
| 779 | (outline-back-to-heading t) | 772 | (outline-back-to-heading t) |
| 780 | (outline-flag-region (1- (point)) | 773 | (outline-flag-region (1- (point)) |
| 781 | (progn (outline-next-preface) (point)) nil))) | 774 | (progn (outline-next-preface) (point)) nil))) |
| 775 | |||
| 776 | (define-obsolete-function-alias | ||
| 777 | 'show-entry 'outline-show-entry "25.1") | ||
| 782 | 778 | ||
| 783 | (defun hide-body () | 779 | (defun outline-hide-body () |
| 784 | "Hide all body lines in buffer, leaving all headings visible." | 780 | "Hide all body lines in buffer, leaving all headings visible." |
| 785 | (interactive) | 781 | (interactive) |
| 786 | (hide-region-body (point-min) (point-max))) | 782 | (outline-hide-region-body (point-min) (point-max))) |
| 783 | |||
| 784 | (define-obsolete-function-alias | ||
| 785 | 'hide-body 'outline-hide-body "25.1") | ||
| 787 | 786 | ||
| 788 | (defun hide-region-body (start end) | 787 | (defun outline-hide-region-body (start end) |
| 789 | "Hide all body lines in the region, but not headings." | 788 | "Hide all body lines in the region, but not headings." |
| 790 | ;; Nullify the hook to avoid repeated calls to `outline-flag-region' | 789 | ;; Nullify the hook to avoid repeated calls to `outline-flag-region' |
| 791 | ;; wasting lots of time running `lazy-lock-fontify-after-outline' | 790 | ;; wasting lots of time running `lazy-lock-fontify-after-outline' |
| @@ -806,30 +805,47 @@ Show the heading too, if it is currently invisible." | |||
| 806 | (outline-end-of-heading)))))) | 805 | (outline-end-of-heading)))))) |
| 807 | (run-hooks 'outline-view-change-hook)) | 806 | (run-hooks 'outline-view-change-hook)) |
| 808 | 807 | ||
| 809 | (defun show-all () | 808 | (define-obsolete-function-alias |
| 809 | 'hide-region-body 'outline-hide-region-body "25.1") | ||
| 810 | |||
| 811 | (defun outline-show-all () | ||
| 810 | "Show all of the text in the buffer." | 812 | "Show all of the text in the buffer." |
| 811 | (interactive) | 813 | (interactive) |
| 812 | (outline-flag-region (point-min) (point-max) nil)) | 814 | (outline-flag-region (point-min) (point-max) nil)) |
| 813 | 815 | ||
| 814 | (defun hide-subtree () | 816 | (define-obsolete-function-alias |
| 817 | 'show-all 'outline-show-all "25.1") | ||
| 818 | |||
| 819 | (defun outline-hide-subtree () | ||
| 815 | "Hide everything after this heading at deeper levels." | 820 | "Hide everything after this heading at deeper levels." |
| 816 | (interactive) | 821 | (interactive) |
| 817 | (outline-flag-subtree t)) | 822 | (outline-flag-subtree t)) |
| 818 | 823 | ||
| 819 | (defun hide-leaves () | 824 | (define-obsolete-function-alias |
| 825 | 'hide-subtree 'outline-hide-subtree "25.1") | ||
| 826 | |||
| 827 | (defun outline-hide-leaves () | ||
| 820 | "Hide the body after this heading and at deeper levels." | 828 | "Hide the body after this heading and at deeper levels." |
| 821 | (interactive) | 829 | (interactive) |
| 822 | (save-excursion | 830 | (save-excursion |
| 823 | (outline-back-to-heading) | 831 | (outline-back-to-heading) |
| 824 | ;; Turned off to fix bug reported by Otto Maddox on 22 Nov 2005. | 832 | ;; Turned off to fix bug reported by Otto Maddox on 22 Nov 2005. |
| 825 | ;; (outline-end-of-heading) | 833 | ;; (outline-end-of-heading) |
| 826 | (hide-region-body (point) (progn (outline-end-of-subtree) (point))))) | 834 | (outline-hide-region-body |
| 835 | (point) | ||
| 836 | (progn (outline-end-of-subtree) (point))))) | ||
| 827 | 837 | ||
| 828 | (defun show-subtree () | 838 | (define-obsolete-function-alias |
| 839 | 'hide-leaves 'outline-hide-leaves "25.1") | ||
| 840 | |||
| 841 | (defun outline-show-subtree () | ||
| 829 | "Show everything after this heading at deeper levels." | 842 | "Show everything after this heading at deeper levels." |
| 830 | (interactive) | 843 | (interactive) |
| 831 | (outline-flag-subtree nil)) | 844 | (outline-flag-subtree nil)) |
| 832 | 845 | ||
| 846 | (define-obsolete-function-alias | ||
| 847 | 'show-subtree 'outline-show-subtree "25.1") | ||
| 848 | |||
| 833 | (defun outline-show-heading () | 849 | (defun outline-show-heading () |
| 834 | "Show the current heading and move to its end." | 850 | "Show the current heading and move to its end." |
| 835 | (outline-flag-region (- (point) | 851 | (outline-flag-region (- (point) |
| @@ -840,7 +856,7 @@ Show the heading too, if it is currently invisible." | |||
| 840 | (progn (outline-end-of-heading) (point)) | 856 | (progn (outline-end-of-heading) (point)) |
| 841 | nil)) | 857 | nil)) |
| 842 | 858 | ||
| 843 | (defun hide-sublevels (levels) | 859 | (defun outline-hide-sublevels (levels) |
| 844 | "Hide everything but the top LEVELS levels of headers, in whole buffer." | 860 | "Hide everything but the top LEVELS levels of headers, in whole buffer." |
| 845 | (interactive (list | 861 | (interactive (list |
| 846 | (cond | 862 | (cond |
| @@ -878,14 +894,17 @@ Show the heading too, if it is currently invisible." | |||
| 878 | (outline-flag-region (1- (point)) (point) nil)))) | 894 | (outline-flag-region (1- (point)) (point) nil)))) |
| 879 | (run-hooks 'outline-view-change-hook)) | 895 | (run-hooks 'outline-view-change-hook)) |
| 880 | 896 | ||
| 881 | (defun hide-other () | 897 | (define-obsolete-function-alias |
| 898 | 'hide-sublevels 'outline-hide-sublevels "25.1") | ||
| 899 | |||
| 900 | (defun outline-hide-other () | ||
| 882 | "Hide everything except current body and parent and top-level headings." | 901 | "Hide everything except current body and parent and top-level headings." |
| 883 | (interactive) | 902 | (interactive) |
| 884 | (hide-sublevels 1) | 903 | (outline-hide-sublevels 1) |
| 885 | (let (outline-view-change-hook) | 904 | (let (outline-view-change-hook) |
| 886 | (save-excursion | 905 | (save-excursion |
| 887 | (outline-back-to-heading t) | 906 | (outline-back-to-heading t) |
| 888 | (show-entry) | 907 | (outline-show-entry) |
| 889 | (while (condition-case nil (progn (outline-up-heading 1 t) (not (bobp))) | 908 | (while (condition-case nil (progn (outline-up-heading 1 t) (not (bobp))) |
| 890 | (error nil)) | 909 | (error nil)) |
| 891 | (outline-flag-region (1- (point)) | 910 | (outline-flag-region (1- (point)) |
| @@ -893,15 +912,18 @@ Show the heading too, if it is currently invisible." | |||
| 893 | nil)))) | 912 | nil)))) |
| 894 | (run-hooks 'outline-view-change-hook)) | 913 | (run-hooks 'outline-view-change-hook)) |
| 895 | 914 | ||
| 915 | (define-obsolete-function-alias | ||
| 916 | 'hide-other 'outline-hide-other "25.1") | ||
| 917 | |||
| 896 | (defun outline-toggle-children () | 918 | (defun outline-toggle-children () |
| 897 | "Show or hide the current subtree depending on its current state." | 919 | "Show or hide the current subtree depending on its current state." |
| 898 | (interactive) | 920 | (interactive) |
| 899 | (save-excursion | 921 | (save-excursion |
| 900 | (outline-back-to-heading) | 922 | (outline-back-to-heading) |
| 901 | (if (not (outline-invisible-p (line-end-position))) | 923 | (if (not (outline-invisible-p (line-end-position))) |
| 902 | (hide-subtree) | 924 | (outline-hide-subtree) |
| 903 | (show-children) | 925 | (outline-show-children) |
| 904 | (show-entry)))) | 926 | (outline-show-entry)))) |
| 905 | 927 | ||
| 906 | (defun outline-flag-subtree (flag) | 928 | (defun outline-flag-subtree (flag) |
| 907 | (save-excursion | 929 | (save-excursion |
| @@ -928,12 +950,15 @@ Show the heading too, if it is currently invisible." | |||
| 928 | ;; leave blank line before heading | 950 | ;; leave blank line before heading |
| 929 | (forward-char -1)))))) | 951 | (forward-char -1)))))) |
| 930 | 952 | ||
| 931 | (defun show-branches () | 953 | (defun outline-show-branches () |
| 932 | "Show all subheadings of this heading, but not their bodies." | 954 | "Show all subheadings of this heading, but not their bodies." |
| 933 | (interactive) | 955 | (interactive) |
| 934 | (show-children 1000)) | 956 | (outline-show-children 1000)) |
| 957 | |||
| 958 | (define-obsolete-function-alias | ||
| 959 | 'show-branches 'outline-show-branches "25.1") | ||
| 935 | 960 | ||
| 936 | (defun show-children (&optional level) | 961 | (defun outline-show-children (&optional level) |
| 937 | "Show all direct subheadings of this heading. | 962 | "Show all direct subheadings of this heading. |
| 938 | Prefix arg LEVEL is how many levels below the current level should be shown. | 963 | Prefix arg LEVEL is how many levels below the current level should be shown. |
| 939 | Default is enough to cause the following heading to appear." | 964 | Default is enough to cause the following heading to appear." |
| @@ -960,6 +985,9 @@ Default is enough to cause the following heading to appear." | |||
| 960 | (if (eobp) (point-max) (1+ (point))))))) | 985 | (if (eobp) (point-max) (1+ (point))))))) |
| 961 | (run-hooks 'outline-view-change-hook)) | 986 | (run-hooks 'outline-view-change-hook)) |
| 962 | 987 | ||
| 988 | (define-obsolete-function-alias | ||
| 989 | 'show-children 'outline-show-children "25.1") | ||
| 990 | |||
| 963 | 991 | ||
| 964 | 992 | ||
| 965 | (defun outline-up-heading (arg &optional invisible-ok) | 993 | (defun outline-up-heading (arg &optional invisible-ok) |