changeset 6077:7c17887a0daf

(outline-minor-mode-prefix): Change to C-c C-o. (hide-sublevels, hide-other): New functions. (outline-mode-map): New key bindings. New menu bindings.
author Richard M. Stallman <rms@gnu.org>
date Thu, 24 Feb 1994 22:37:49 +0000
parents 4f76564fc2cd
children 81290a55365b
files lisp/textmodes/ooutline.el
diffstat 1 files changed, 47 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/ooutline.el	Thu Feb 24 22:36:24 1994 +0000
+++ b/lisp/textmodes/ooutline.el	Thu Feb 24 22:37:49 1994 +0000
@@ -60,10 +60,22 @@
   (define-key outline-mode-map "\C-c\C-u" 'outline-up-heading)
   (define-key outline-mode-map "\C-c\C-f" 'outline-forward-same-level)
   (define-key outline-mode-map "\C-c\C-b" 'outline-backward-same-level)
+  (define-key outline-mode-map "\C-c\C-t" 'hide-body)
+  (define-key outline-mode-map "\C-c\C-a" 'show-all)
+  (define-key outline-mode-map "\C-c\C-c" 'hide-entry)
+  (define-key outline-mode-map "\C-c\C-e" 'show-entry)
+  (define-key outline-mode-map "\C-c\C-l" 'hide-leaves)
+  (define-key outline-mode-map "\C-c\C-k" 'show-branches)
+  (define-key outline-mode-map "\C-c\C-q" 'outline-hide-sublevels)
+  (define-key outline-mode-map "\C-c\C-o" 'outline-hide-other)
 
   (define-key outline-mode-map [menu-bar hide]
     (cons "Hide" (make-sparse-keymap "Hide")))
 
+  (define-key outline-mode-map [menu-bar hide hide-other]
+    '("Hide Other" . outline-hide-other))
+  (define-key outline-mode-map [menu-bar hide hide-sublevels]
+    '("Hide Sublevels" . outline-hide-sublevels))
   (define-key outline-mode-map [menu-bar hide hide-subtree]
     '("Hide Subtree" . hide-subtree))
   (define-key outline-mode-map [menu-bar hide hide-entry]
@@ -170,7 +182,7 @@
   (add-hook 'change-major-mode-hook 'show-all)
   (run-hooks 'text-mode-hook 'outline-mode-hook))
 
-(defvar outline-minor-mode-prefix "\C-c"
+(defvar outline-minor-mode-prefix "\C-c\C-o"
   "*Prefix key to use for Outline commands in Outline minor mode.")
 
 (defvar outline-minor-mode-map nil)
@@ -339,6 +351,40 @@
   (interactive)
   (outline-flag-subtree ?\n))
 
+(defun hide-sublevels (keep-levels)
+  "Hide everything except the first KEEP-LEVEL headers."
+  (interactive "p")
+  (if (< keep-levels 1)
+      (error "Must keep at least one level of headers"))
+  (setq keep-levels (1- keep-levels))
+  (save-excursion
+    (goto-char (point-min))
+    (hide-subtree)
+    (show-children keep-levels)
+    (condition-case err
+      (while (outline-get-next-sibling)
+	(hide-subtree)
+	(show-children keep-levels))
+      (error nil))))
+
+(defun hide-other ()
+  "Hide everything except for the current body and the parent headings."
+  (interactive)
+  (outline-hide-sublevels 1)
+  (let ((last (point))
+	(pos (point)))
+    (while (save-excursion
+	     (and (re-search-backward "[\n\r]" nil t)
+		  (eq (following-char) ?\r)))
+      (save-excursion
+	(beginning-of-line)
+	(if (eq last (point))
+	    (progn
+	      (outline-next-heading)
+	      (outline-flag-region last (point) ?\n))
+	  (show-children)
+	  (setq last (point)))))))
+
 (defun outline-flag-subtree (flag)
   (save-excursion
     (outline-back-to-heading)