]> code.delx.au - gnu-emacs/blobdiff - lisp/outline.el
Update docs for `customize-mode'
[gnu-emacs] / lisp / outline.el
index d8c49b312a8974462ed412a2e13c937f32090969..2001cdf27b12c3def73373e9c90a93680cecb837 100644 (file)
@@ -1,6 +1,6 @@
 ;;; outline.el --- outline mode commands for Emacs
 
-;; Copyright (C) 1986, 1993-1995, 1997, 2000-2015 Free Software
+;; Copyright (C) 1986, 1993-1995, 1997, 2000-2016 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -233,6 +233,7 @@ in the file it applies to.")
    outline-5 outline-6 outline-7 outline-8])
 
 (defun outline-font-lock-face ()
+  "Return one of `outline-font-lock-faces' for current level."
   (save-excursion
     (goto-char (match-beginning 0))
     (looking-at outline-regexp)
@@ -337,7 +338,7 @@ numbered and unnumbered sections), list them set by set and sorted by level
 within each set.  For example in texinfo mode:
 
      (setq outline-heading-alist
-      '((\"@chapter\" . 2) (\"@section\" . 3) (\"@subsection\" . 4)
+      \\='((\"@chapter\" . 2) (\"@section\" . 3) (\"@subsection\" . 4)
            (\"@subsubsection\" . 5)
         (\"@unnumbered\" . 2) (\"@unnumberedsec\" . 3)
            (\"@unnumberedsubsec\" . 4)  (\"@unnumberedsubsubsec\" . 5)
@@ -387,7 +388,8 @@ at the end of the buffer."
                      nil 'move))
 
 (defsubst outline-invisible-p (&optional pos)
-  "Non-nil if the character after point is invisible."
+  "Non-nil if the character after POS is invisible.
+If POS is nil, use `point' instead."
   (get-char-property (or pos (point)) 'invisible))
 
 (defun outline-back-to-heading (&optional invisible-ok)
@@ -400,7 +402,7 @@ Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
          (while (not found)
            (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
                                    nil t)
-               (error "before first heading"))
+                (error "Before first heading"))
            (setq found (and (or invisible-ok (not (outline-invisible-p)))
                             (point)))))
        (goto-char found)
@@ -435,6 +437,9 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
     (run-hooks 'outline-insert-heading-hook)))
 
 (defun outline-invent-heading (head up)
+  "Create a heading by using heading HEAD as a template.
+When UP is non-nil, the created heading will be one level above.
+Otherwise, it will be one level below."
   (save-match-data
     ;; Let's try to invent one by repeating or deleting the last char.
     (let ((new-head (if up (substring head 0 -1)
@@ -444,13 +449,13 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
           ;; Why bother checking that it is indeed higher/lower level ?
           new-head
         ;; Didn't work, so ask what to do.
-        (read-string (format "%s heading for `%s': "
-                             (if up "Parent" "Demoted") head)
+        (read-string (format-message "%s heading for `%s': "
+                                    (if up "Parent" "Demoted") head)
                      head nil nil t)))))
 
 (defun outline-promote (&optional which)
   "Promote headings higher up the tree.
-If transient-mark-mode is on, and mark is active, promote headings in
+If `transient-mark-mode' is on, and mark is active, promote headings in
 the region (from a Lisp program, pass `region' for WHICH).  Otherwise:
 without prefix argument, promote current heading and all headings in the
 subtree (from a Lisp program, pass `subtree' for WHICH); with prefix
@@ -489,7 +494,7 @@ nil for WHICH, or do not pass any argument)."
 
 (defun outline-demote (&optional which)
   "Demote headings lower down the tree.
-If transient-mark-mode is on, and mark is active, demote headings in
+If `transient-mark-mode' is on, and mark is active, demote headings in
 the region (from a Lisp program, pass `region' for WHICH).  Otherwise:
 without prefix argument, demote current heading and all headings in the
 subtree (from a Lisp program, pass `subtree' for WHICH); with prefix
@@ -531,7 +536,7 @@ nil for WHICH, or do not pass any argument)."
       (replace-match down-head nil t)))))
 
 (defun outline-head-from-level (level head &optional alist)
-  "Get new heading with level LEVEL from ALIST.
+  "Get new heading with level LEVEL, closest to HEAD, from ALIST.
 If there are no such entries, return nil.
 ALIST defaults to `outline-heading-alist'.
 Similar to (car (rassoc LEVEL ALIST)).
@@ -627,12 +632,13 @@ the match data is set appropriately."
     (move-marker ins-point nil)))
 
 (defun outline-end-of-heading ()
+  "Move to one char before the next `outline-heading-end-regexp'."
   (if (re-search-forward outline-heading-end-regexp nil 'move)
       (forward-char -1)))
 
 (defun outline-next-visible-heading (arg)
   "Move to the next visible heading line.
-With argument, repeats or can move backward if negative.
+With ARG, repeats or can move backward if negative.
 A heading line is one that starts with a `*' (or that
 `outline-regexp' matches)."
   (interactive "p")
@@ -660,7 +666,7 @@ A heading line is one that starts with a `*' (or that
 
 (defun outline-previous-visible-heading (arg)
   "Move to the previous heading line.
-With argument, repeats or can move forward if negative.
+With ARG, repeats or can move forward if negative.
 A heading line is one that starts with a `*' (or that
 `outline-regexp' matches)."
   (interactive "p")
@@ -771,7 +777,12 @@ Show the heading too, if it is currently invisible."
   (save-excursion
     (outline-back-to-heading t)
     (outline-flag-region (1- (point))
-                         (progn (outline-next-preface) (point)) nil)))
+                         (progn
+                           (outline-next-preface)
+                           (if (= 1 (- (point-max) (point)))
+                               (point-max)
+                             (point)))
+                         nil)))
 
 (define-obsolete-function-alias
     'show-entry 'outline-show-entry "25.1")
@@ -785,7 +796,7 @@ Show the heading too, if it is currently invisible."
     'hide-body 'outline-hide-body "25.1")
 
 (defun outline-hide-region-body (start end)
-  "Hide all body lines in the region, but not headings."
+  "Hide all body lines between START and END, but not headings."
   ;; Nullify the hook to avoid repeated calls to `outline-flag-region'
   ;; wasting lots of time running `lazy-lock-fontify-after-outline'
   ;; and run the hook finally.
@@ -926,6 +937,7 @@ Show the heading too, if it is currently invisible."
       (outline-show-entry))))
 
 (defun outline-flag-subtree (flag)
+  "Assign FLAG to the current subtree."
   (save-excursion
     (outline-back-to-heading)
     (outline-end-of-heading)
@@ -934,6 +946,7 @@ Show the heading too, if it is currently invisible."
                          flag)))
 
 (defun outline-end-of-subtree ()
+  "Move to the end of the current subtree."
   (outline-back-to-heading)
   (let ((first t)
        (level (funcall outline-level)))
@@ -1070,7 +1083,7 @@ If there is no such heading, return nil."
         (point)))))
 \f
 (defun outline-headers-as-kill (beg end)
-  "Save the visible outline headers in region at the start of the kill ring.
+  "Save the visible outline headers between BEG and END to the kill ring.
 
 Text shown between the headers isn't copied.  Two newlines are
 inserted between saved headers.  Yanking the result may be a