aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/outline.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/outline.el b/lisp/outline.el
index 48c0a2576fd..7242bc987d0 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -152,7 +152,7 @@ in the file it applies to."
152 (cons '(--- "---") (cdr x)))) 152 (cons '(--- "---") (cdr x))))
153 outline-mode-menu-bar-map)))))) 153 outline-mode-menu-bar-map))))))
154 map)) 154 map))
155 155
156 156
157(defvar outline-mode-map 157(defvar outline-mode-map
158 (let ((map (make-sparse-keymap))) 158 (let ((map (make-sparse-keymap)))
@@ -213,6 +213,9 @@ in the file it applies to."
213(defvar outline-view-change-hook nil 213(defvar outline-view-change-hook nil
214 "Normal hook to be run after outline visibility changes.") 214 "Normal hook to be run after outline visibility changes.")
215 215
216(defvar outline-mode-hook nil
217 "*This hook is run when outline mode starts.")
218
216;;;###autoload 219;;;###autoload
217(define-derived-mode outline-mode text-mode "Outline" 220(define-derived-mode outline-mode text-mode "Outline"
218 "Set major mode for editing outlines with selective display. 221 "Set major mode for editing outlines with selective display.
@@ -268,7 +271,8 @@ Turning on outline mode calls the value of `text-mode-hook' and then of
268 '(outline-font-lock-keywords t nil nil backward-paragraph)) 271 '(outline-font-lock-keywords t nil nil backward-paragraph))
269 (setq imenu-generic-expression 272 (setq imenu-generic-expression
270 (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))) 273 (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0)))
271 (add-hook 'change-major-mode-hook 'show-all nil t)) 274 (add-hook 'change-major-mode-hook 'show-all nil t)
275 (run-hooks 'outline-mode-hook))
272 276
273(defcustom outline-minor-mode-prefix "\C-c@" 277(defcustom outline-minor-mode-prefix "\C-c@"
274 "*Prefix key to use for Outline commands in Outline minor mode. 278 "*Prefix key to use for Outline commands in Outline minor mode.
@@ -440,10 +444,10 @@ in the region."
440 (save-match-data 444 (save-match-data
441 (outline-up-heading 1 t) 445 (outline-up-heading 1 t)
442 (match-string 0)))))) 446 (match-string 0))))))
443 447
444 (unless (rassoc level outline-heading-alist) 448 (unless (rassoc level outline-heading-alist)
445 (push (cons head level) outline-heading-alist)) 449 (push (cons head level) outline-heading-alist))
446 450
447 (replace-match up-head nil t))))) 451 (replace-match up-head nil t)))))
448 452
449(defun outline-demote (&optional children) 453(defun outline-demote (&optional children)
@@ -555,7 +559,7 @@ the match data is set appropriately."
555 "Move the currrent subtree down past ARG headlines of the same level." 559 "Move the currrent subtree down past ARG headlines of the same level."
556 (interactive "p") 560 (interactive "p")
557 (let ((re (concat "^" outline-regexp)) 561 (let ((re (concat "^" outline-regexp))
558 (movfunc (if (> arg 0) 'outline-get-next-sibling 562 (movfunc (if (> arg 0) 'outline-get-next-sibling
559 'outline-get-last-sibling)) 563 'outline-get-last-sibling))
560 (ins-point (make-marker)) 564 (ins-point (make-marker))
561 (cnt (abs arg)) 565 (cnt (abs arg))
@@ -563,8 +567,8 @@ the match data is set appropriately."
563 ;; Select the tree 567 ;; Select the tree
564 (outline-back-to-heading) 568 (outline-back-to-heading)
565 (setq beg (point)) 569 (setq beg (point))
566 (save-match-data 570 (save-match-data
567 (save-excursion (outline-end-of-heading) 571 (save-excursion (outline-end-of-heading)
568 (setq folded (outline-invisible-p))) 572 (setq folded (outline-invisible-p)))
569 (outline-end-of-subtree)) 573 (outline-end-of-subtree))
570 (if (= (char-after) ?\n) (forward-char 1)) 574 (if (= (char-after) ?\n) (forward-char 1))
@@ -578,7 +582,7 @@ the match data is set appropriately."
578 (setq cnt (1- cnt))) 582 (setq cnt (1- cnt)))
579 (if (> arg 0) 583 (if (> arg 0)
580 ;; Moving forward - still need to move over subtree 584 ;; Moving forward - still need to move over subtree
581 (progn (outline-end-of-subtree) 585 (progn (outline-end-of-subtree)
582 (if (= (char-after) ?\n) (forward-char 1)))) 586 (if (= (char-after) ?\n) (forward-char 1))))
583 (move-marker ins-point (point)) 587 (move-marker ins-point (point))
584 (insert (delete-and-extract-region beg end)) 588 (insert (delete-and-extract-region beg end))
@@ -657,7 +661,7 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden."
657 ;; reveal do the rest, by simply doing: 661 ;; reveal do the rest, by simply doing:
658 ;; (remove-overlays (overlay-start o) (overlay-end o) 662 ;; (remove-overlays (overlay-start o) (overlay-end o)
659 ;; 'invisible 'outline) 663 ;; 'invisible 'outline)
660 ;; 664 ;;
661 ;; That works fine as long as everything is in sync, but if the 665 ;; That works fine as long as everything is in sync, but if the
662 ;; structure of the document is changed while revealing parts of it, 666 ;; structure of the document is changed while revealing parts of it,
663 ;; the resulting behavior can be ugly. I.e. we need to make 667 ;; the resulting behavior can be ugly. I.e. we need to make