changeset 67440:840a1e4fe08b

* foldout.el (foldout-exit-fold): Properly hide subtree.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 09 Dec 2005 20:50:15 +0000
parents 54512729495b
children cba8f90d0adb
files lisp/ChangeLog lisp/foldout.el
diffstat 2 files changed, 22 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Dec 09 19:30:35 2005 +0000
+++ b/lisp/ChangeLog	Fri Dec 09 20:50:15 2005 +0000
@@ -1,3 +1,7 @@
+2005-12-09  Chong Yidong  <cyd@stupidchicken.com>
+
+	* foldout.el (foldout-exit-fold): Properly hide subtree.
+
 2005-12-09  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* files.el (save-buffer):
--- a/lisp/foldout.el	Fri Dec 09 19:30:35 2005 +0000
+++ b/lisp/foldout.el	Fri Dec 09 20:50:15 2005 +0000
@@ -308,7 +308,8 @@
 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 @@
       ;; 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))
+      (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))
-	    ))
+	;; 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)