diff options
author | Juri Linkov <juri@jurta.org> | 2004-05-01 03:44:30 +0000 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2004-05-01 03:44:30 +0000 |
commit | ca858c641956fc46532613a876ce2f7b70d85bde (patch) | |
tree | 42e9142d056eccd6a7454ea6b42ced6e6fb0af8e /lisp/outline.el | |
parent | 3adff3ce7d59f1cb86bb6705e04be812e1e36f13 (diff) | |
download | emacs-ca858c641956fc46532613a876ce2f7b70d85bde.tar.gz |
(outline-blank-line): New var.
(outline-next-preface, outline-show-heading)
(outline-end-of-subtree): Use it.
Diffstat (limited to 'lisp/outline.el')
-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." (defvar outline-mode-hook nil "*This hook is run when outline mode starts.") +(defvar outline-blank-line nil + "*Non-nil means to leave unhidden blank line before heading.") + ;;;###autoload (define-derived-mode outline-mode text-mode "Outline" "Set major mode for editing outlines with selective display. @@ -349,7 +352,7 @@ at the end of the buffer." (if (re-search-forward (concat "\n\\(?:" outline-regexp "\\)") nil 'move) (goto-char (match-beginning 0))) - (if (and (bolp) (eobp) (not (bobp))) + (if (and (bolp) (or outline-blank-line (eobp)) (not (bobp))) (forward-char -1))) (defun outline-next-heading () @@ -769,7 +772,11 @@ Show the heading too, if it is currently invisible." (defun outline-show-heading () "Show the current heading and move to its end." - (outline-flag-region (- (point) (if (bobp) 0 1)) + (outline-flag-region (- (point) + (if (bobp) 0 + (if (and outline-blank-line + (eq (char-before (1- (point))) ?\n)) + 2 1))) (progn (outline-end-of-heading) (point)) nil)) @@ -837,7 +844,10 @@ Show the heading too, if it is currently invisible." (if (bolp) (progn ;; Go to end of line before heading - (forward-char -1))))) + (forward-char -1) + (if (and outline-blank-line (bolp)) + ;; leave blank line before heading + (forward-char -1)))))) (defun show-branches () "Show all subheadings of this heading, but not their bodies." |