Mercurial > emacs
diff lisp/allout.el @ 73315:df3186ae0953
* allout.el (allout-back-to-current-heading): Base on lower-level
routines to get proper disqualification of aberrant topics.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 09 Oct 2006 23:34:11 +0000 |
parents | 16a7031b0447 |
children | 4a5c7b0a29cc 2d56e13fd23d 8dd8c8286063 |
line wrap: on
line diff
--- a/lisp/allout.el Mon Oct 09 20:51:00 2006 +0000 +++ b/lisp/allout.el Mon Oct 09 23:34:11 2006 +0000 @@ -2736,24 +2736,22 @@ (1- allout-recent-prefix-end))) ;;;_ > allout-back-to-current-heading () (defun allout-back-to-current-heading () - "Move to heading line of current topic, or beginning if already on the line. - -Return value of point, unless we started outside of (before any) topics, -in which case we return nil." + "Move to heading line of current topic, or beginning if not in a topic. + +If interactive, we position at the end of the prefix. + +Return value of resulting point, unless we started outside +of (before any) topics, in which case we return nil." (allout-beginning-of-current-line) - (if (or (allout-on-current-heading-p) - (and (re-search-backward (concat "^\\(" allout-regexp "\\)") - nil 'move) - (progn (while (allout-hidden-p) - (allout-beginning-of-current-line) - (if (not (looking-at allout-regexp)) - (re-search-backward allout-regexp - nil 'move))) - (allout-prefix-data)))) - (if (interactive-p) - (allout-end-of-prefix) - (point)))) + (let ((bol-point (point))) + (allout-goto-prefix-doublechecked) + (if (<= (point) bol-point) + (if (interactive-p) + (allout-end-of-prefix) + (point)) + (goto-char (point-min)) + nil))) ;;;_ > allout-back-to-heading () (defalias 'allout-back-to-heading 'allout-back-to-current-heading) ;;;_ > allout-pre-next-prefix ()