comparison lisp/foldout.el @ 90261:7beb78bc1f8e

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 616-696) - Add lisp/mh-e/.arch-inventory - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: lisp/smerge-mode.el: Add 'tools' to file keywords. - lisp/gnus/ChangeLog: Remove duplicate entry * gnus--rel--5.10 (patch 147-181) - Update from CVS - Merge from emacs--cvs-trunk--0 - Update from CVS: lisp/mml.el (mml-preview): Doc fix. - Update from CVS: texi/message.texi: Fix default values. - Update from CVS: texi/gnus.texi (RSS): Addition.
author Miles Bader <miles@gnu.org>
date Mon, 16 Jan 2006 08:37:27 +0000
parents 2d92f5c9d6ae 81c5a29b3800
children c5406394f567
comparison
equal deleted inserted replaced
90260:0ca0d9181b5e 90261:7beb78bc1f8e
1 ;;; foldout.el --- folding extensions for outline-mode and outline-minor-mode 1 ;;; foldout.el --- folding extensions for outline-mode and outline-minor-mode
2 2
3 ;; Copyright (C) 1994, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 3 ;; Copyright (C) 1994, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 4
5 ;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk> 5 ;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk>
6 ;; Maintainer: FSF
6 ;; Created: 27 Jan 1994 7 ;; Created: 27 Jan 1994
7 ;; Version: foldout.el 1.10 dated 94/05/19 at 17:09:12 8 ;; Version: foldout.el 1.10 dated 94/05/19 at 17:09:12
8 ;; Keywords: folding, outlines 9 ;; Keywords: folding, outlines
9 10
10 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
306 "Return to the ARG'th enclosing fold view. With ARG = 0 exit all folds. 307 "Return to the ARG'th enclosing fold view. With ARG = 0 exit all folds.
307 308
308 Normally causes exited folds to be hidden, but with ARG < 0, -ARG folds are 309 Normally causes exited folds to be hidden, but with ARG < 0, -ARG folds are
309 exited and text is left visible." 310 exited and text is left visible."
310 (interactive "p") 311 (interactive "p")
311 (let (start-marker end-marker (hide-fold t)) 312 (let ((hide-fold t) start-marker end-marker
313 beginning-of-heading end-of-subtree)
312 314
313 ;; check there are some folds to leave 315 ;; check there are some folds to leave
314 (if (null foldout-fold-list) 316 (if (null foldout-fold-list)
315 (error "Not in a fold!")) 317 (error "Not in a fold!"))
316 318
353 355
354 ;; Also, make sure that the newline before the following heading 356 ;; Also, make sure that the newline before the following heading
355 ;; is \n otherwise it will be hidden. If there is a newline 357 ;; is \n otherwise it will be hidden. If there is a newline
356 ;; before this one, make it visible too so we do the same as 358 ;; before this one, make it visible too so we do the same as
357 ;; outline.el and leave a blank line before the heading. 359 ;; outline.el and leave a blank line before the heading.
358 (if (zerop num-folds) 360 (when (zerop num-folds)
359 (let ((beginning-of-heading (point)) 361 (if end-marker
360 (end-of-subtree (if end-marker 362 (setq beginning-of-heading (point)
361 (progn 363 end-of-subtree (progn (forward-char -1)
362 (forward-char -1) 364 (if (memq (preceding-char)
363 (if (memq (preceding-char) 365 '(?\n ?\^M))
364 '(?\n ?\^M)) 366 (forward-char -1))
365 (forward-char -1)) 367 (point))))
366 (point)) 368 ;; hide the subtree
367 (point-max)))) 369 (when hide-fold
368 ;; hide the subtree 370 (goto-char start-marker)
369 (if hide-fold 371 (hide-subtree))
370 (outline-flag-region start-marker end-of-subtree 372
371 foldout-hide-flag)) 373 ;; make sure the next heading is exposed
372 374 (if end-marker
373 ;; make sure the next heading is exposed 375 (outline-flag-region end-of-subtree beginning-of-heading
374 (if end-marker 376 foldout-show-flag)))
375 (outline-flag-region end-of-subtree beginning-of-heading
376 foldout-show-flag))
377 ))
378 377
379 ;; zap the markers so they don't slow down editing 378 ;; zap the markers so they don't slow down editing
380 (set-marker start-marker nil) 379 (set-marker start-marker nil)
381 (if end-marker (set-marker end-marker nil)) 380 (if end-marker (set-marker end-marker nil))
382 ) 381 )