/[emacs]/emacs/lisp/outline.el
ViewVC logotype

Diff of /emacs/lisp/outline.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26