comparison 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
comparison
equal deleted inserted replaced
73314:6c5a67740a8e 73315:df3186ae0953
2734 (if (not (allout-current-depth)) 2734 (if (not (allout-current-depth))
2735 nil 2735 nil
2736 (1- allout-recent-prefix-end))) 2736 (1- allout-recent-prefix-end)))
2737 ;;;_ > allout-back-to-current-heading () 2737 ;;;_ > allout-back-to-current-heading ()
2738 (defun allout-back-to-current-heading () 2738 (defun allout-back-to-current-heading ()
2739 "Move to heading line of current topic, or beginning if already on the line. 2739 "Move to heading line of current topic, or beginning if not in a topic.
2740 2740
2741 Return value of point, unless we started outside of (before any) topics, 2741 If interactive, we position at the end of the prefix.
2742 in which case we return nil." 2742
2743 Return value of resulting point, unless we started outside
2744 of (before any) topics, in which case we return nil."
2743 2745
2744 (allout-beginning-of-current-line) 2746 (allout-beginning-of-current-line)
2745 (if (or (allout-on-current-heading-p) 2747 (let ((bol-point (point)))
2746 (and (re-search-backward (concat "^\\(" allout-regexp "\\)") 2748 (allout-goto-prefix-doublechecked)
2747 nil 'move) 2749 (if (<= (point) bol-point)
2748 (progn (while (allout-hidden-p) 2750 (if (interactive-p)
2749 (allout-beginning-of-current-line) 2751 (allout-end-of-prefix)
2750 (if (not (looking-at allout-regexp)) 2752 (point))
2751 (re-search-backward allout-regexp 2753 (goto-char (point-min))
2752 nil 'move))) 2754 nil)))
2753 (allout-prefix-data))))
2754 (if (interactive-p)
2755 (allout-end-of-prefix)
2756 (point))))
2757 ;;;_ > allout-back-to-heading () 2755 ;;;_ > allout-back-to-heading ()
2758 (defalias 'allout-back-to-heading 'allout-back-to-current-heading) 2756 (defalias 'allout-back-to-heading 'allout-back-to-current-heading)
2759 ;;;_ > allout-pre-next-prefix () 2757 ;;;_ > allout-pre-next-prefix ()
2760 (defun allout-pre-next-prefix () 2758 (defun allout-pre-next-prefix ()
2761 "Skip forward to just before the next heading line. 2759 "Skip forward to just before the next heading line.