From 8d683c8e16315d3cc114bc271b7ea493e8c24d2c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 19 Feb 2007 18:48:58 +0000 Subject: [PATCH] (hide-sublevels): Keep empty last line, if available. --- lisp/ChangeLog | 2 ++ lisp/outline.el | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c26efc42ece..7bea73a2329 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2007-02-19 Stefan Monnier + * outline.el (hide-sublevels): Keep empty last line, if available. + * buff-menu.el (list-buffers-noselect): Use explicit unicode code rather than the corresponding unicode char, to make the code more readable. diff --git a/lisp/outline.el b/lisp/outline.el index 20dfb2429ef..579997754f2 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -856,19 +856,25 @@ Show the heading too, if it is currently invisible." (t 1)))) (if (< levels 1) (error "Must keep at least one level of headers")) - (let (outline-view-change-hook) - (save-excursion - (goto-char (point-min)) - ;; Skip the prelude, if any. - (unless (outline-on-heading-p t) (outline-next-heading)) + (save-excursion + (let* (outline-view-change-hook + (beg (progn + (goto-char (point-min)) + ;; Skip the prelude, if any. + (unless (outline-on-heading-p t) (outline-next-heading)) + (point))) + (end (progn + (goto-char (point-max)) + ;; Keep empty last line, if available. + (if (bolp) (1- (point)) (point))))) ;; First hide everything. - (outline-flag-region (point) (point-max) t) + (outline-flag-region beg end t) ;; Then unhide the top level headers. (outline-map-region (lambda () (if (<= (funcall outline-level) levels) (outline-show-heading))) - (point) (point-max)))) + beg end))) (run-hooks 'outline-view-change-hook)) (defun hide-other () -- 2.39.2