Mercurial > emacs
comparison lisp/textmodes/outline.el @ 25177:0ac130f2181a
(outline-previous-heading): New function.
(outline-up-heading-all): Use outline-previous-heading.
(outline-next-heading): Delete definition inserted yesterday.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 05 Aug 1999 14:50:30 +0000 |
parents | 01b59199fcbc |
children | ce06277761dc |
comparison
equal
deleted
inserted
replaced
25176:51eb4568f70b | 25177:0ac130f2181a |
---|---|
327 "Move to the next (possibly invisible) heading line." | 327 "Move to the next (possibly invisible) heading line." |
328 (interactive) | 328 (interactive) |
329 (if (re-search-forward (concat "\n\\(" outline-regexp "\\)") | 329 (if (re-search-forward (concat "\n\\(" outline-regexp "\\)") |
330 nil 'move) | 330 nil 'move) |
331 (goto-char (1+ (match-beginning 0))))) | 331 (goto-char (1+ (match-beginning 0))))) |
332 | |
333 (defun outline-previous-heading () | |
334 "Move to the previous (possibly invisible) heading line." | |
335 (interactive) | |
336 (re-search-backward (concat "^\\(" outline-regexp "\\)") | |
337 nil 'move)) | |
332 | 338 |
333 (defsubst outline-visible () | 339 (defsubst outline-visible () |
334 "Non-nil if the character after point is visible." | 340 "Non-nil if the character after point is visible." |
335 (not (get-char-property (point) 'invisible))) | 341 (not (get-char-property (point) 'invisible))) |
336 | 342 |
643 (progn (outline-end-of-heading) (point)) | 649 (progn (outline-end-of-heading) (point)) |
644 nil))))))) | 650 nil))))))) |
645 (run-hooks 'outline-view-change-hook)) | 651 (run-hooks 'outline-view-change-hook)) |
646 | 652 |
647 (defun outline-up-heading-all (arg) | 653 (defun outline-up-heading-all (arg) |
648 "Move to the heading line of which the present line is a subheading. | 654 "Move to the heading line of which the present line is a subheading. |
649 This function considers both visible and invisible heading lines. | 655 This function considers both visible and invisible heading lines. |
650 With argument, move up ARG levels." | 656 With argument, move up ARG levels." |
651 (outline-back-to-heading t) | 657 (outline-back-to-heading t) |
652 (if (eq (funcall outline-level) 1) | 658 (if (eq (funcall outline-level) 1) |
653 (error "Already at top level of the outline")) | 659 (error "Already at top level of the outline")) |
655 (> arg 0) | 661 (> arg 0) |
656 (not (bobp))) | 662 (not (bobp))) |
657 (let ((present-level (funcall outline-level))) | 663 (let ((present-level (funcall outline-level))) |
658 (while (and (not (< (funcall outline-level) present-level)) | 664 (while (and (not (< (funcall outline-level) present-level)) |
659 (not (bobp))) | 665 (not (bobp))) |
660 (outline-next-heading -1)) | 666 (outline-previous-heading)) |
661 (setq arg (- arg 1))))) | 667 (setq arg (- arg 1))))) |
662 | 668 |
663 (defun outline-next-heading (arg) | |
664 "Move to the next heading line (visible or invisible). | |
665 With argument, repeats or can move backward if negative. | |
666 A heading line is one that starts with a `*' (or that | |
667 `outline-regexp' matches)." | |
668 (if (< arg 0) | |
669 (beginning-of-line) | |
670 (end-of-line)) | |
671 (while (and (not (bobp)) (< arg 0)) | |
672 (while (and (not (bobp)) | |
673 (re-search-backward (concat "^\\(" outline-regexp "\\)") | |
674 nil 'move))) | |
675 (setq arg (1+ arg))) | |
676 (while (and (not (eobp)) (> arg 0)) | |
677 (while (and (not (eobp)) | |
678 (re-search-forward (concat "^\\(" outline-regexp "\\)") | |
679 nil 'move))) | |
680 (setq arg (1- arg))) | |
681 (beginning-of-line)) | |
682 | |
683 (defun outline-up-heading (arg) | 669 (defun outline-up-heading (arg) |
684 "Move to the visible heading line of which the present line is a subheading. | 670 "Move to the visible heading line of which the present line is a subheading. |
685 With argument, move up ARG levels." | 671 With argument, move up ARG levels." |
686 (interactive "p") | 672 (interactive "p") |
687 (outline-back-to-heading) | 673 (outline-back-to-heading) |