Mercurial > emacs
changeset 52067:36323dc1a2ac
(outline-mode-hook): Define it.
(outline-mode): Use it, as the documentation says.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 28 Jul 2003 21:50:05 +0000 |
parents | 9a40de6a1802 |
children | f1581f949f71 |
files | lisp/outline.el |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/outline.el Mon Jul 28 19:49:30 2003 +0000 +++ b/lisp/outline.el Mon Jul 28 21:50:05 2003 +0000 @@ -152,7 +152,7 @@ (cons '(--- "---") (cdr x)))) outline-mode-menu-bar-map)))))) map)) - + (defvar outline-mode-map (let ((map (make-sparse-keymap))) @@ -213,6 +213,9 @@ (defvar outline-view-change-hook nil "Normal hook to be run after outline visibility changes.") +(defvar outline-mode-hook nil + "*This hook is run when outline mode starts.") + ;;;###autoload (define-derived-mode outline-mode text-mode "Outline" "Set major mode for editing outlines with selective display. @@ -268,7 +271,8 @@ '(outline-font-lock-keywords t nil nil backward-paragraph)) (setq imenu-generic-expression (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))) - (add-hook 'change-major-mode-hook 'show-all nil t)) + (add-hook 'change-major-mode-hook 'show-all nil t) + (run-hooks 'outline-mode-hook)) (defcustom outline-minor-mode-prefix "\C-c@" "*Prefix key to use for Outline commands in Outline minor mode. @@ -440,10 +444,10 @@ (save-match-data (outline-up-heading 1 t) (match-string 0)))))) - + (unless (rassoc level outline-heading-alist) (push (cons head level) outline-heading-alist)) - + (replace-match up-head nil t))))) (defun outline-demote (&optional children) @@ -555,7 +559,7 @@ "Move the currrent subtree down past ARG headlines of the same level." (interactive "p") (let ((re (concat "^" outline-regexp)) - (movfunc (if (> arg 0) 'outline-get-next-sibling + (movfunc (if (> arg 0) 'outline-get-next-sibling 'outline-get-last-sibling)) (ins-point (make-marker)) (cnt (abs arg)) @@ -563,8 +567,8 @@ ;; Select the tree (outline-back-to-heading) (setq beg (point)) - (save-match-data - (save-excursion (outline-end-of-heading) + (save-match-data + (save-excursion (outline-end-of-heading) (setq folded (outline-invisible-p))) (outline-end-of-subtree)) (if (= (char-after) ?\n) (forward-char 1)) @@ -578,7 +582,7 @@ (setq cnt (1- cnt))) (if (> arg 0) ;; Moving forward - still need to move over subtree - (progn (outline-end-of-subtree) + (progn (outline-end-of-subtree) (if (= (char-after) ?\n) (forward-char 1)))) (move-marker ins-point (point)) (insert (delete-and-extract-region beg end)) @@ -657,7 +661,7 @@ ;; reveal do the rest, by simply doing: ;; (remove-overlays (overlay-start o) (overlay-end o) ;; 'invisible 'outline) - ;; + ;; ;; That works fine as long as everything is in sync, but if the ;; structure of the document is changed while revealing parts of it, ;; the resulting behavior can be ugly. I.e. we need to make