comparison lisp/outline.el @ 90813:e6fdae9180d4

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 698-710) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 216) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-196
author Miles Bader <miles@gnu.org>
date Tue, 24 Apr 2007 21:56:25 +0000
parents dd7c098af727 54e83bd9ac02
children f55f9811f5d7
comparison
equal deleted inserted replaced
90812:6137cc8ddf90 90813:e6fdae9180d4
998 (progn 998 (progn
999 (setq arg 0) 999 (setq arg 0)
1000 (error "No following same-level heading")))))) 1000 (error "No following same-level heading"))))))
1001 1001
1002 (defun outline-get-next-sibling () 1002 (defun outline-get-next-sibling ()
1003 "Move to next heading of the same level, and return point or nil if none." 1003 "Move to next heading of the same level, and return point.
1004 If there is no such heading, return nil."
1004 (let ((level (funcall outline-level))) 1005 (let ((level (funcall outline-level)))
1005 (outline-next-visible-heading 1) 1006 (outline-next-visible-heading 1)
1006 (while (and (not (eobp)) (> (funcall outline-level) level)) 1007 (while (and (not (eobp)) (> (funcall outline-level) level))
1007 (outline-next-visible-heading 1)) 1008 (outline-next-visible-heading 1))
1008 (if (or (eobp) (< (funcall outline-level) level)) 1009 (if (or (eobp) (< (funcall outline-level) level))
1024 (progn 1025 (progn
1025 (setq arg 0) 1026 (setq arg 0)
1026 (error "No previous same-level heading")))))) 1027 (error "No previous same-level heading"))))))
1027 1028
1028 (defun outline-get-last-sibling () 1029 (defun outline-get-last-sibling ()
1029 "Move to previous heading of the same level, and return point or nil if none." 1030 "Move to previous heading of the same level, and return point.
1030 (let ((level (funcall outline-level))) 1031 If there is no such heading, return nil."
1032 (let ((opoint (point))
1033 (level (funcall outline-level)))
1031 (outline-previous-visible-heading 1) 1034 (outline-previous-visible-heading 1)
1032 (while (and (> (funcall outline-level) level) 1035 (when (and (/= (point) opoint) (outline-on-heading-p))
1033 (not (bobp))) 1036 (while (and (> (funcall outline-level) level)
1034 (outline-previous-visible-heading 1)) 1037 (not (bobp)))
1035 (if (< (funcall outline-level) level) 1038 (outline-previous-visible-heading 1))
1036 nil 1039 (if (< (funcall outline-level) level)
1037 (point)))) 1040 nil
1041 (point)))))
1038 1042
1039 (defun outline-headers-as-kill (beg end) 1043 (defun outline-headers-as-kill (beg end)
1040 "Save the visible outline headers in region at the start of the kill ring. 1044 "Save the visible outline headers in region at the start of the kill ring.
1041 1045
1042 Text shown between the headers isn't copied. Two newlines are 1046 Text shown between the headers isn't copied. Two newlines are