1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-24 10:38:38 +00:00

* outline.el (outline-get-next-sibling): Clarify docstring.

(outline-get-last-sibling): Handle case where we are at the first
heading.  Clarify docstring.
This commit is contained in:
Chong Yidong 2007-04-13 01:17:51 +00:00
parent cb2ec9315e
commit 29779b2d7b
2 changed files with 19 additions and 9 deletions

View 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> 2007-04-12 Nick Roberts <nickrob@snap.net.nz>
* progmodes/gud.el (gud-minor-mode-map): Make go button same same * progmodes/gud.el (gud-minor-mode-map): Make go button same same

View File

@ -1000,7 +1000,8 @@ Stop at the first and last subheadings of a superior heading."
(error "No following same-level heading")))))) (error "No following same-level heading"))))))
(defun outline-get-next-sibling () (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))) (let ((level (funcall outline-level)))
(outline-next-visible-heading 1) (outline-next-visible-heading 1)
(while (and (not (eobp)) (> (funcall outline-level) level)) (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")))))) (error "No previous same-level heading"))))))
(defun outline-get-last-sibling () (defun outline-get-last-sibling ()
"Move to previous heading of the same level, and return point or nil if none." "Move to previous heading of the same level, and return point.
(let ((level (funcall outline-level))) If there is no such heading, return nil."
(let ((opoint (point))
(level (funcall outline-level)))
(outline-previous-visible-heading 1) (outline-previous-visible-heading 1)
(while (and (> (funcall outline-level) level) (when (and (/= (point) opoint) (outline-on-heading-p))
(not (bobp))) (while (and (> (funcall outline-level) level)
(outline-previous-visible-heading 1)) (not (bobp)))
(if (< (funcall outline-level) level) (outline-previous-visible-heading 1))
nil (if (< (funcall outline-level) level)
(point)))) nil
(point)))))
(defun outline-headers-as-kill (beg end) (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 in region at the start of the kill ring.