# HG changeset patch # User Chong Yidong # Date 1176427071 0 # Node ID 54e83bd9ac026e10cbe4082f528c80471326c4b9 # Parent 8401cf53f231dfb00ee2af65b8b2c5d5aadf5107 * outline.el (outline-get-next-sibling): Clarify docstring. (outline-get-last-sibling): Handle case where we are at the first heading. Clarify docstring. diff -r 8401cf53f231 -r 54e83bd9ac02 lisp/ChangeLog --- a/lisp/ChangeLog Thu Apr 12 23:23:25 2007 +0000 +++ b/lisp/ChangeLog Fri Apr 13 01:17:51 2007 +0000 @@ -1,3 +1,9 @@ +2007-04-12 Chong Yidong + + * outline.el (outline-get-next-sibling): Clarify docstring. + (outline-get-last-sibling): Handle case where we are at the first + heading. Clarify docstring. + 2007-04-12 Nick Roberts * progmodes/gud.el (gud-minor-mode-map): Make go button same same diff -r 8401cf53f231 -r 54e83bd9ac02 lisp/outline.el --- a/lisp/outline.el Thu Apr 12 23:23:25 2007 +0000 +++ b/lisp/outline.el Fri Apr 13 01:17:51 2007 +0000 @@ -1000,7 +1000,8 @@ (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 @@ (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.