aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-05-22 09:27:36 +0000
committerRichard M. Stallman1994-05-22 09:27:36 +0000
commita144b9e93b95ca35757292105bd98642818606c5 (patch)
tree40431372eca4264ca0fb95b6e22e094e8e39513f
parent0a56d3643a5edb507c6e97d37a8a2b11708c1676 (diff)
downloademacs-a144b9e93b95ca35757292105bd98642818606c5.tar.gz
emacs-a144b9e93b95ca35757292105bd98642818606c5.zip
(foldout-exit-fold): Make numeric argument work;
before, it always exited one fold. Replace the Common Lisp `loop' construct with `while'.
-rw-r--r--lisp/foldout.el111
1 files changed, 57 insertions, 54 deletions
diff --git a/lisp/foldout.el b/lisp/foldout.el
index 03a06bdc086..822533fdf54 100644
--- a/lisp/foldout.el
+++ b/lisp/foldout.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk> 5;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk>
6;; Created: 27 Jan 1994 6;; Created: 27 Jan 1994
7;; Version: foldout.el 1.9 dated 94/03/15 at 14:10:40 7;; Version: foldout.el 1.10 dated 94/05/19 at 17:09:12
8;; Keywords: folding, outline 8;; Keywords: folding, outline
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
@@ -120,6 +120,13 @@
120 120
121;;; ChangeLog: 121;;; ChangeLog:
122 122
123;; 1.10 21-Mar-94
124;; foldout.el is now part of the GNU Emacs distribution!!
125;; Put in changes made by RMS to version 1.8 to keep the diffs to a minimum.
126;; bugfix: numeric arg to foldout-exit-fold wasn't working - looks like I don't
127;; know how to use the Common LISP `loop' macro after all, so use `while'
128;; instead.
129
123;; 1.9 15-Mar-94 130;; 1.9 15-Mar-94
124;; Didn't test that very well, did I? The change to foldout-zoom-subtree 131;; Didn't test that very well, did I? The change to foldout-zoom-subtree
125;; affected foldout-mouse-zoom: if the heading under the `level n' one clicked 132;; affected foldout-mouse-zoom: if the heading under the `level n' one clicked
@@ -313,59 +320,55 @@ exited and text is left visible."
313 320
314 ;; exit the folds 321 ;; exit the folds
315 (widen) 322 (widen)
316 (loop 323 (while (not (zerop num-folds))
317 always (progn 324 ;; get the fold at the top of the stack
318 ;; get the fold at the top of the stack 325 (setq start-marker (car (car foldout-fold-list))
319 (setq start-marker (car (car foldout-fold-list)) 326 end-marker (cdr (car foldout-fold-list))
320 end-marker (cdr (car foldout-fold-list)) 327 foldout-fold-list (cdr foldout-fold-list)
321 foldout-fold-list (cdr foldout-fold-list) 328 num-folds (1- num-folds))
322 num-folds (1- num-folds)) 329
323 330 ;; Make sure there is a newline at the end of this fold,
324 ;; Make sure there is a newline at the end of this fold, 331 ;; otherwise the following heading will get joined to the body
325 ;; otherwise the following heading will get joined to the body 332 ;; text.
326 ;; text. 333 (if end-marker
327 (if end-marker 334 (progn
328 (progn 335 (goto-char end-marker)
329 (goto-char end-marker) 336 (forward-char -1)
330 (forward-char -1) 337 (or (memq (preceding-char) '(?\n ?\^M))
331 (or (memq (preceding-char) '(?\n ?\^M)) 338 (insert ?\n))))
332 (insert ?\n)))) 339
333 340 ;; If this is the last fold to exit, hide the text unless we've
334 ;; If this is the last fold to exit, hide the text unless we've 341 ;; been told not to. Note that at the moment point is at the
335 ;; been told not to. Note that at the moment point is at the 342 ;; beginning of the following heading if there is one.
336 ;; beginning of the following heading if there is one. 343
337 344 ;; Also, make sure that the newline before the following heading
338 ;; Also, make sure that the newline before the following heading 345 ;; is \n otherwise it will be hidden. If there is a newline
339 ;; is \n otherwise it will be hidden. If there is a newline 346 ;; before this one, make it visible too so we do the same as
340 ;; before this one, make it visible too so we do the same as 347 ;; outline.el and leave a blank line before the heading.
341 ;; outline.el and leave a blank line before the heading. 348 (if (zerop num-folds)
342 (if (zerop num-folds) 349 (let ((beginning-of-heading (point))
343 (let ((beginning-of-heading (point)) 350 (end-of-subtree (if end-marker
344 (end-of-subtree (if end-marker 351 (progn
345 (progn 352 (forward-char -1)
346 (forward-char -1) 353 (if (memq (preceding-char)
347 (if (memq (preceding-char) 354 '(?\n ?\^M))
348 '(?\n ?\^M)) 355 (forward-char -1))
349 (forward-char -1)) 356 (point))
350 (point)) 357 (point-max))))
351 (point-max)))) 358 ;; hide the subtree
352 ;; hide the subtree 359 (if hide-fold
353 (if hide-fold 360 (outline-flag-region start-marker end-of-subtree ?\^M))
354 (outline-flag-region start-marker end-of-subtree ?\^M)) 361
355 362 ;; make sure the next heading is exposed
356 ;; make sure the next heading is exposed 363 (if end-marker
357 (if end-marker 364 (outline-flag-region end-of-subtree
358 (outline-flag-region end-of-subtree 365 beginning-of-heading ?\n))
359 beginning-of-heading ?\n)) 366 ))
360 )) 367
361 368 ;; zap the markers so they don't slow down editing
362 ;; zap the markers so they don't slow down editing 369 (set-marker start-marker nil)
363 (set-marker start-marker nil) 370 (if end-marker (set-marker end-marker nil))
364 (if end-marker (set-marker end-marker nil)) 371 )
365 )
366
367 ;; have we exited enough folds?
368 until (zerop num-folds))
369 372
370 ;; narrow to the enclosing fold if there is one 373 ;; narrow to the enclosing fold if there is one
371 (if foldout-fold-list 374 (if foldout-fold-list