diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2007-04-13 01:17:51 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2007-04-13 01:17:51 +0000 |
commit | 29779b2d7bb3d3810ec36754ea9a6856f29744b2 (patch) | |
tree | ff33209c20a12fc8e1451860cfb3ee6a721b833d /lisp/outline.el | |
parent | cb2ec9315ee1fdb2ffcb527fff76f217a3006177 (diff) | |
download | emacs-29779b2d7bb3d3810ec36754ea9a6856f29744b2.tar.gz |
* outline.el (outline-get-next-sibling): Clarify docstring.
(outline-get-last-sibling): Handle case where we are at the first
heading. Clarify docstring.
Diffstat (limited to 'lisp/outline.el')
-rw-r--r-- | lisp/outline.el | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/outline.el b/lisp/outline.el index 579997754f2..d0c121a12c4 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -1000,7 +1000,8 @@ Stop at the first and last subheadings of a superior heading." (error "No following same-level heading")))))) (defun outline-get-next-sibling () - "Move to next heading of the same level, and return point or nil if none." + "Move to next heading of the same level, and return point. +If there is no such heading, return nil." (let ((level (funcall outline-level))) (outline-next-visible-heading 1) (while (and (not (eobp)) (> (funcall outline-level) level)) @@ -1026,15 +1027,18 @@ Stop at the first and last subheadings of a superior heading." (error "No previous same-level heading")))))) (defun outline-get-last-sibling () - "Move to previous heading of the same level, and return point or nil if none." - (let ((level (funcall outline-level))) + "Move to previous heading of the same level, and return point. +If there is no such heading, return nil." + (let ((opoint (point)) + (level (funcall outline-level))) (outline-previous-visible-heading 1) - (while (and (> (funcall outline-level) level) - (not (bobp))) - (outline-previous-visible-heading 1)) - (if (< (funcall outline-level) level) - nil - (point)))) + (when (and (/= (point) opoint) (outline-on-heading-p)) + (while (and (> (funcall outline-level) level) + (not (bobp))) + (outline-previous-visible-heading 1)) + (if (< (funcall outline-level) level) + nil + (point))))) (defun outline-headers-as-kill (beg end) "Save the visible outline headers in region at the start of the kill ring. |