]> git.eshelyaron.com Git - emacs.git/commitdiff
* outline.el (outline-get-next-sibling): Clarify docstring.
authorChong Yidong <cyd@stupidchicken.com>
Fri, 13 Apr 2007 01:17:51 +0000 (01:17 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Fri, 13 Apr 2007 01:17:51 +0000 (01:17 +0000)
(outline-get-last-sibling): Handle case where we are at the first
heading.  Clarify docstring.

lisp/ChangeLog
lisp/outline.el

index 29e8c5b3c99db811d6efc10544c6d7f891f2b7c4..e5ecd6e081723fde85aaf9138357b883aeeb859a 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-12  Chong Yidong  <cyd@stupidchicken.com>
+
+       * 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  <nickrob@snap.net.nz>
 
        * progmodes/gud.el (gud-minor-mode-map): Make go button same same
index 579997754f2f3afda47dd701946a0fa0096952b0..d0c121a12c4271737c12aa10db630be3d6b8b2c7 100644 (file)
@@ -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)))))
 \f
 (defun outline-headers-as-kill (beg end)
   "Save the visible outline headers in region at the start of the kill ring.