(hide-sublevels): Keep empty last line, if available.

This commit is contained in:
Stefan Monnier 2007-02-19 18:48:58 +00:00
parent c822571ac0
commit 8d683c8e16
2 changed files with 15 additions and 7 deletions

View file

@ -1,5 +1,7 @@
2007-02-19 Stefan Monnier <monnier@iro.umontreal.ca>
* 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.

View file

@ -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 ()