summaryrefslogtreecommitdiff
path: root/lisp/foldout.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2005-12-09 20:50:15 +0000
committerChong Yidong <cyd@stupidchicken.com>2005-12-09 20:50:15 +0000
commit580c588cdc42d914b9b1d6e16a7399463c7e3865 (patch)
treefb640adc9636808889f9feb0ad553fd0aeb9aa00 /lisp/foldout.el
parent7ed81407391e3688ddc3612cbdf7ca0b81ec1ed0 (diff)
downloademacs-580c588cdc42d914b9b1d6e16a7399463c7e3865.tar.gz
* foldout.el (foldout-exit-fold): Properly hide subtree.
Diffstat (limited to 'lisp/foldout.el')
-rw-r--r--lisp/foldout.el40
1 files changed, 19 insertions, 21 deletions
diff --git a/lisp/foldout.el b/lisp/foldout.el
index 54fca4eb6f0..632a09bb05f 100644
--- a/lisp/foldout.el
+++ b/lisp/foldout.el
@@ -308,7 +308,8 @@ optional arg EXPOSURE \(interactively with prefix arg\) changes this:-
Normally causes exited folds to be hidden, but with ARG < 0, -ARG folds are
exited and text is left visible."
(interactive "p")
- (let (start-marker end-marker (hide-fold t))
+ (let ((hide-fold t) start-marker end-marker
+ beginning-of-heading end-of-subtree)
;; check there are some folds to leave
(if (null foldout-fold-list)
@@ -355,26 +356,23 @@ exited and text is left visible."
;; is \n otherwise it will be hidden. If there is a newline
;; before this one, make it visible too so we do the same as
;; outline.el and leave a blank line before the heading.
- (if (zerop num-folds)
- (let ((beginning-of-heading (point))
- (end-of-subtree (if end-marker
- (progn
- (forward-char -1)
- (if (memq (preceding-char)
- '(?\n ?\^M))
- (forward-char -1))
- (point))
- (point-max))))
- ;; hide the subtree
- (if hide-fold
- (outline-flag-region start-marker end-of-subtree
- foldout-hide-flag))
-
- ;; make sure the next heading is exposed
- (if end-marker
- (outline-flag-region end-of-subtree beginning-of-heading
- foldout-show-flag))
- ))
+ (when (zerop num-folds)
+ (if end-marker
+ (setq beginning-of-heading (point)
+ end-of-subtree (progn (forward-char -1)
+ (if (memq (preceding-char)
+ '(?\n ?\^M))
+ (forward-char -1))
+ (point))))
+ ;; hide the subtree
+ (when hide-fold
+ (goto-char start-marker)
+ (hide-subtree))
+
+ ;; make sure the next heading is exposed
+ (if end-marker
+ (outline-flag-region end-of-subtree beginning-of-heading
+ foldout-show-flag)))
;; zap the markers so they don't slow down editing
(set-marker start-marker nil)