aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleh Krehel2015-01-28 11:55:47 +0100
committerOleh Krehel2015-01-30 17:45:05 +0100
commitadebc14b9c1794e49cfab9b3f2c4866acfbdf175 (patch)
tree427818765a5c122eff05241e9e3c3008ebd8a92f
parentac79251493318468162c93b46fe066f6bd7bd328 (diff)
downloademacs-adebc14b9c1794e49cfab9b3f2c4866acfbdf175.tar.gz
emacs-adebc14b9c1794e49cfab9b3f2c4866acfbdf175.zip
lisp/outline.el: Improve docstrings.
-rw-r--r--lisp/ChangeLog16
-rw-r--r--lisp/outline.el26
2 files changed, 33 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e05774f79dd..eac2e44ee5a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,21 @@
12015-01-30 Oleh Krehel <ohwoeowho@gmail.com> 12015-01-30 Oleh Krehel <ohwoeowho@gmail.com>
2 2
3 * outline.el (outline-font-lock-face): Add docstring.
4 (outline-invisible-p): Improve docstring.
5 (outline-invent-heading): Add docstring.
6 (outline-promote): Improve docstring.
7 (outline-demote): Improve docstring.
8 (outline-head-from-level): Improve docstring.
9 (outline-end-of-heading): Add docstring.
10 (outline-next-visible-heading): Improve docstring.
11 (outline-previous-visible-heading): Improve docstring.
12 (outline-hide-region-body): Improve docstring.
13 (outline-flag-subtree): Add docstring.
14 (outline-end-of-subtree): Add docstring.
15 (outline-headers-as-kill): Improve docstring.
16
172015-01-30 Oleh Krehel <ohwoeowho@gmail.com>
18
3 * outline.el (outline-hide-entry): Rename from `hide-entry'. 19 * outline.el (outline-hide-entry): Rename from `hide-entry'.
4 (hide-entry): Declare as obsolete. 20 (hide-entry): Declare as obsolete.
5 (outline-show-entry): Rename from `show-entry'. 21 (outline-show-entry): Rename from `show-entry'.
diff --git a/lisp/outline.el b/lisp/outline.el
index d8c49b312a8..ae31b8088f0 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -233,6 +233,7 @@ in the file it applies to.")
233 outline-5 outline-6 outline-7 outline-8]) 233 outline-5 outline-6 outline-7 outline-8])
234 234
235(defun outline-font-lock-face () 235(defun outline-font-lock-face ()
236 "Return one of `outline-font-lock-faces' for current level."
236 (save-excursion 237 (save-excursion
237 (goto-char (match-beginning 0)) 238 (goto-char (match-beginning 0))
238 (looking-at outline-regexp) 239 (looking-at outline-regexp)
@@ -387,7 +388,8 @@ at the end of the buffer."
387 nil 'move)) 388 nil 'move))
388 389
389(defsubst outline-invisible-p (&optional pos) 390(defsubst outline-invisible-p (&optional pos)
390 "Non-nil if the character after point is invisible." 391 "Non-nil if the character after POS is invisible.
392If POS is nil, use `point' instead."
391 (get-char-property (or pos (point)) 'invisible)) 393 (get-char-property (or pos (point)) 'invisible))
392 394
393(defun outline-back-to-heading (&optional invisible-ok) 395(defun outline-back-to-heading (&optional invisible-ok)
@@ -400,7 +402,7 @@ Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
400 (while (not found) 402 (while (not found)
401 (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)") 403 (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
402 nil t) 404 nil t)
403 (error "before first heading")) 405 (error "Before first heading"))
404 (setq found (and (or invisible-ok (not (outline-invisible-p))) 406 (setq found (and (or invisible-ok (not (outline-invisible-p)))
405 (point))))) 407 (point)))))
406 (goto-char found) 408 (goto-char found)
@@ -435,6 +437,9 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
435 (run-hooks 'outline-insert-heading-hook))) 437 (run-hooks 'outline-insert-heading-hook)))
436 438
437(defun outline-invent-heading (head up) 439(defun outline-invent-heading (head up)
440 "Create a heading by using heading HEAD as a template.
441When UP is non-nil, the created heading will be one level above.
442Otherwise, it will be one level below."
438 (save-match-data 443 (save-match-data
439 ;; Let's try to invent one by repeating or deleting the last char. 444 ;; Let's try to invent one by repeating or deleting the last char.
440 (let ((new-head (if up (substring head 0 -1) 445 (let ((new-head (if up (substring head 0 -1)
@@ -450,7 +455,7 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
450 455
451(defun outline-promote (&optional which) 456(defun outline-promote (&optional which)
452 "Promote headings higher up the tree. 457 "Promote headings higher up the tree.
453If transient-mark-mode is on, and mark is active, promote headings in 458If `transient-mark-mode' is on, and mark is active, promote headings in
454the region (from a Lisp program, pass `region' for WHICH). Otherwise: 459the region (from a Lisp program, pass `region' for WHICH). Otherwise:
455without prefix argument, promote current heading and all headings in the 460without prefix argument, promote current heading and all headings in the
456subtree (from a Lisp program, pass `subtree' for WHICH); with prefix 461subtree (from a Lisp program, pass `subtree' for WHICH); with prefix
@@ -489,7 +494,7 @@ nil for WHICH, or do not pass any argument)."
489 494
490(defun outline-demote (&optional which) 495(defun outline-demote (&optional which)
491 "Demote headings lower down the tree. 496 "Demote headings lower down the tree.
492If transient-mark-mode is on, and mark is active, demote headings in 497If `transient-mark-mode' is on, and mark is active, demote headings in
493the region (from a Lisp program, pass `region' for WHICH). Otherwise: 498the region (from a Lisp program, pass `region' for WHICH). Otherwise:
494without prefix argument, demote current heading and all headings in the 499without prefix argument, demote current heading and all headings in the
495subtree (from a Lisp program, pass `subtree' for WHICH); with prefix 500subtree (from a Lisp program, pass `subtree' for WHICH); with prefix
@@ -531,7 +536,7 @@ nil for WHICH, or do not pass any argument)."
531 (replace-match down-head nil t))))) 536 (replace-match down-head nil t)))))
532 537
533(defun outline-head-from-level (level head &optional alist) 538(defun outline-head-from-level (level head &optional alist)
534 "Get new heading with level LEVEL from ALIST. 539 "Get new heading with level LEVEL, closest to HEAD, from ALIST.
535If there are no such entries, return nil. 540If there are no such entries, return nil.
536ALIST defaults to `outline-heading-alist'. 541ALIST defaults to `outline-heading-alist'.
537Similar to (car (rassoc LEVEL ALIST)). 542Similar to (car (rassoc LEVEL ALIST)).
@@ -627,12 +632,13 @@ the match data is set appropriately."
627 (move-marker ins-point nil))) 632 (move-marker ins-point nil)))
628 633
629(defun outline-end-of-heading () 634(defun outline-end-of-heading ()
635 "Move to one char before the next `outline-heading-end-regexp'."
630 (if (re-search-forward outline-heading-end-regexp nil 'move) 636 (if (re-search-forward outline-heading-end-regexp nil 'move)
631 (forward-char -1))) 637 (forward-char -1)))
632 638
633(defun outline-next-visible-heading (arg) 639(defun outline-next-visible-heading (arg)
634 "Move to the next visible heading line. 640 "Move to the next visible heading line.
635With argument, repeats or can move backward if negative. 641With ARG, repeats or can move backward if negative.
636A heading line is one that starts with a `*' (or that 642A heading line is one that starts with a `*' (or that
637`outline-regexp' matches)." 643`outline-regexp' matches)."
638 (interactive "p") 644 (interactive "p")
@@ -660,7 +666,7 @@ A heading line is one that starts with a `*' (or that
660 666
661(defun outline-previous-visible-heading (arg) 667(defun outline-previous-visible-heading (arg)
662 "Move to the previous heading line. 668 "Move to the previous heading line.
663With argument, repeats or can move forward if negative. 669With ARG, repeats or can move forward if negative.
664A heading line is one that starts with a `*' (or that 670A heading line is one that starts with a `*' (or that
665`outline-regexp' matches)." 671`outline-regexp' matches)."
666 (interactive "p") 672 (interactive "p")
@@ -785,7 +791,7 @@ Show the heading too, if it is currently invisible."
785 'hide-body 'outline-hide-body "25.1") 791 'hide-body 'outline-hide-body "25.1")
786 792
787(defun outline-hide-region-body (start end) 793(defun outline-hide-region-body (start end)
788 "Hide all body lines in the region, but not headings." 794 "Hide all body lines between START and END, but not headings."
789 ;; Nullify the hook to avoid repeated calls to `outline-flag-region' 795 ;; Nullify the hook to avoid repeated calls to `outline-flag-region'
790 ;; wasting lots of time running `lazy-lock-fontify-after-outline' 796 ;; wasting lots of time running `lazy-lock-fontify-after-outline'
791 ;; and run the hook finally. 797 ;; and run the hook finally.
@@ -926,6 +932,7 @@ Show the heading too, if it is currently invisible."
926 (outline-show-entry)))) 932 (outline-show-entry))))
927 933
928(defun outline-flag-subtree (flag) 934(defun outline-flag-subtree (flag)
935 "Assign FLAG to the current subtree."
929 (save-excursion 936 (save-excursion
930 (outline-back-to-heading) 937 (outline-back-to-heading)
931 (outline-end-of-heading) 938 (outline-end-of-heading)
@@ -934,6 +941,7 @@ Show the heading too, if it is currently invisible."
934 flag))) 941 flag)))
935 942
936(defun outline-end-of-subtree () 943(defun outline-end-of-subtree ()
944 "Move to the end of the current subtree."
937 (outline-back-to-heading) 945 (outline-back-to-heading)
938 (let ((first t) 946 (let ((first t)
939 (level (funcall outline-level))) 947 (level (funcall outline-level)))
@@ -1070,7 +1078,7 @@ If there is no such heading, return nil."
1070 (point))))) 1078 (point)))))
1071 1079
1072(defun outline-headers-as-kill (beg end) 1080(defun outline-headers-as-kill (beg end)
1073 "Save the visible outline headers in region at the start of the kill ring. 1081 "Save the visible outline headers between BEG and END to the kill ring.
1074 1082
1075Text shown between the headers isn't copied. Two newlines are 1083Text shown between the headers isn't copied. Two newlines are
1076inserted between saved headers. Yanking the result may be a 1084inserted between saved headers. Yanking the result may be a