diff options
| author | Juri Linkov | 2004-05-01 03:44:30 +0000 |
|---|---|---|
| committer | Juri Linkov | 2004-05-01 03:44:30 +0000 |
| commit | ca858c641956fc46532613a876ce2f7b70d85bde (patch) | |
| tree | 42e9142d056eccd6a7454ea6b42ced6e6fb0af8e | |
| parent | 3adff3ce7d59f1cb86bb6705e04be812e1e36f13 (diff) | |
| download | emacs-ca858c641956fc46532613a876ce2f7b70d85bde.tar.gz emacs-ca858c641956fc46532613a876ce2f7b70d85bde.zip | |
(outline-blank-line): New var.
(outline-next-preface, outline-show-heading)
(outline-end-of-subtree): Use it.
| -rw-r--r-- | lisp/outline.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/outline.el b/lisp/outline.el index 2985b432824..0f7d3b627b0 100644 --- a/lisp/outline.el +++ b/lisp/outline.el | |||
| @@ -216,6 +216,9 @@ in the file it applies to." | |||
| 216 | (defvar outline-mode-hook nil | 216 | (defvar outline-mode-hook nil |
| 217 | "*This hook is run when outline mode starts.") | 217 | "*This hook is run when outline mode starts.") |
| 218 | 218 | ||
| 219 | (defvar outline-blank-line nil | ||
| 220 | "*Non-nil means to leave unhidden blank line before heading.") | ||
| 221 | |||
| 219 | ;;;###autoload | 222 | ;;;###autoload |
| 220 | (define-derived-mode outline-mode text-mode "Outline" | 223 | (define-derived-mode outline-mode text-mode "Outline" |
| 221 | "Set major mode for editing outlines with selective display. | 224 | "Set major mode for editing outlines with selective display. |
| @@ -349,7 +352,7 @@ at the end of the buffer." | |||
| 349 | (if (re-search-forward (concat "\n\\(?:" outline-regexp "\\)") | 352 | (if (re-search-forward (concat "\n\\(?:" outline-regexp "\\)") |
| 350 | nil 'move) | 353 | nil 'move) |
| 351 | (goto-char (match-beginning 0))) | 354 | (goto-char (match-beginning 0))) |
| 352 | (if (and (bolp) (eobp) (not (bobp))) | 355 | (if (and (bolp) (or outline-blank-line (eobp)) (not (bobp))) |
| 353 | (forward-char -1))) | 356 | (forward-char -1))) |
| 354 | 357 | ||
| 355 | (defun outline-next-heading () | 358 | (defun outline-next-heading () |
| @@ -769,7 +772,11 @@ Show the heading too, if it is currently invisible." | |||
| 769 | 772 | ||
| 770 | (defun outline-show-heading () | 773 | (defun outline-show-heading () |
| 771 | "Show the current heading and move to its end." | 774 | "Show the current heading and move to its end." |
| 772 | (outline-flag-region (- (point) (if (bobp) 0 1)) | 775 | (outline-flag-region (- (point) |
| 776 | (if (bobp) 0 | ||
| 777 | (if (and outline-blank-line | ||
| 778 | (eq (char-before (1- (point))) ?\n)) | ||
| 779 | 2 1))) | ||
| 773 | (progn (outline-end-of-heading) (point)) | 780 | (progn (outline-end-of-heading) (point)) |
| 774 | nil)) | 781 | nil)) |
| 775 | 782 | ||
| @@ -837,7 +844,10 @@ Show the heading too, if it is currently invisible." | |||
| 837 | (if (bolp) | 844 | (if (bolp) |
| 838 | (progn | 845 | (progn |
| 839 | ;; Go to end of line before heading | 846 | ;; Go to end of line before heading |
| 840 | (forward-char -1))))) | 847 | (forward-char -1) |
| 848 | (if (and outline-blank-line (bolp)) | ||
| 849 | ;; leave blank line before heading | ||
| 850 | (forward-char -1)))))) | ||
| 841 | 851 | ||
| 842 | (defun show-branches () | 852 | (defun show-branches () |
| 843 | "Show all subheadings of this heading, but not their bodies." | 853 | "Show all subheadings of this heading, but not their bodies." |