]> code.delx.au - gnu-emacs/blobdiff - lisp/outline.el
(Abbrevs): A @node line without explicit Prev, Next, and Up links.
[gnu-emacs] / lisp / outline.el
index 8a05aaf0cd93ac82403fcde8bf2d25b083529c9c..92542bae7e307e7c6c73600aaa28d57e7a894876 100644 (file)
@@ -1,7 +1,7 @@
 ;;; outline.el --- outline mode commands for Emacs
 
 ;; Copyright (C) 1986, 1993, 1994, 1995, 1997, 2000, 2001, 2002,
-;;   2003, 2004, 2005 Free Software Foundation, Inc.
+;;   2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: outlines
@@ -46,7 +46,7 @@
   :group 'editing)
 
 (defcustom outline-regexp "[*\^L]+"
-  "*Regular expression to match the beginning of a heading.
+  "Regular expression to match the beginning of a heading.
 Any line whose beginning matches this regexp is considered to start a heading.
 Note that Outline mode only checks this regexp at the start of a line,
 so the regexp need not (and usually does not) start with `^'.
@@ -56,7 +56,7 @@ in the file it applies to.  See also `outline-heading-end-regexp'."
   :group 'outlines)
 
 (defcustom outline-heading-end-regexp "\n"
-  "*Regular expression to match the end of a heading line.
+  "Regular expression to match the end of a heading line.
 You can assume that point is at the beginning of a heading when this
 regexp is searched for.  The heading ends at the end of the match.
 The recommended way to set this is with a `Local Variables:' list
@@ -803,11 +803,12 @@ Show the heading too, if it is currently invisible."
   (outline-flag-subtree t))
 
 (defun hide-leaves ()
-  "Hide all body after this heading at deeper levels."
+  "Hide the body after this heading and at deeper levels."
   (interactive)
   (save-excursion
     (outline-back-to-heading)
-    (outline-end-of-heading)
+;; Turned off to fix bug reported by Otto Maddox on 22 Nov 2005.
+;;    (outline-end-of-heading)
     (hide-region-body (point) (progn (outline-end-of-subtree) (point)))))
 
 (defun show-subtree ()
@@ -827,7 +828,13 @@ Show the heading too, if it is currently invisible."
 
 (defun hide-sublevels (levels)
   "Hide everything but the top LEVELS levels of headers, in whole buffer."
-  (interactive "p")
+  (interactive (list
+               (cond
+                (current-prefix-arg (prefix-numeric-value current-prefix-arg))
+                ((save-excursion (beginning-of-line)
+                                 (looking-at outline-regexp))
+                 (funcall outline-level))
+                (t 1))))
   (if (< levels 1)
       (error "Must keep at least one level of headers"))
   (let (outline-view-change-hook)