aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-03-10 23:49:00 +0000
committerKarl Heuer1994-03-10 23:49:00 +0000
commiteb6692ed468ecc811b587ea42015499ce27cf550 (patch)
treed045cbd10d9d825a8f3c2898ea91889881a1b1ae
parent19c0a7309d9f81605f8864711342739a3b5bcadd (diff)
downloademacs-eb6692ed468ecc811b587ea42015499ce27cf550.tar.gz
emacs-eb6692ed468ecc811b587ea42015499ce27cf550.zip
(outline-mode, outline-level): Doc fix.
(outline-on-heading-p): Use bolp, not bobp. (outline-hide-other): Rename from hide-other. (outline-hide-sublevels): Rename from hide-sublevels. (outline-back-to-heading): Error if no previous heading. (outline-next-visible-heading): Check for search failure. (outline-hide-sublevels): Ignore text before first outline heading. (outline-level): Count characters, not columns, so ^L is level 1.
-rw-r--r--lisp/textmodes/ooutline.el50
1 files changed, 27 insertions, 23 deletions
diff --git a/lisp/textmodes/ooutline.el b/lisp/textmodes/ooutline.el
index a9a6c959a24..1f86c51b6e3 100644
--- a/lisp/textmodes/ooutline.el
+++ b/lisp/textmodes/ooutline.el
@@ -77,9 +77,9 @@ in the file it applies to.")
77 (define-key outline-mode-map [menu-bar hide] 77 (define-key outline-mode-map [menu-bar hide]
78 (cons "Hide" (make-sparse-keymap "Hide"))) 78 (cons "Hide" (make-sparse-keymap "Hide")))
79 79
80 (define-key outline-mode-map [menu-bar hide hide-other] 80 (define-key outline-mode-map [menu-bar hide outline-hide-other]
81 '("Hide Other" . outline-hide-other)) 81 '("Hide Other" . outline-hide-other))
82 (define-key outline-mode-map [menu-bar hide hide-sublevels] 82 (define-key outline-mode-map [menu-bar hide outline-hide-sublevels]
83 '("Hide Sublevels" . outline-hide-sublevels)) 83 '("Hide Sublevels" . outline-hide-sublevels))
84 (define-key outline-mode-map [menu-bar hide hide-subtree] 84 (define-key outline-mode-map [menu-bar hide hide-subtree]
85 '("Hide Subtree" . hide-subtree)) 85 '("Hide Subtree" . hide-subtree))
@@ -144,8 +144,8 @@ Commands:\\<outline-mode-map>
144\\[outline-backward-same-level] outline-backward-same-level 144\\[outline-backward-same-level] outline-backward-same-level
145\\[outline-up-heading] outline-up-heading move from subheading to heading 145\\[outline-up-heading] outline-up-heading move from subheading to heading
146 146
147M-x hide-body make all text invisible (not headings). 147\\[hide-body] make all text invisible (not headings).
148M-x show-all make everything in buffer visible. 148\\[show-all] make everything in buffer visible.
149 149
150The remaining commands are used when point is on a heading line. 150The remaining commands are used when point is on a heading line.
151They apply to some of the body or subheadings of that heading. 151They apply to some of the body or subheadings of that heading.
@@ -154,11 +154,11 @@ They apply to some of the body or subheadings of that heading.
154\\[show-children] show-children make direct subheadings visible. 154\\[show-children] show-children make direct subheadings visible.
155 No effect on body, or subheadings 2 or more levels down. 155 No effect on body, or subheadings 2 or more levels down.
156 With arg N, affects subheadings N levels down. 156 With arg N, affects subheadings N levels down.
157M-x hide-entry make immediately following body invisible. 157\\[hide-entry] make immediately following body invisible.
158M-x show-entry make it visible. 158\\[show-entry] make it visible.
159M-x hide-leaves make body under heading and under its subheadings invisible. 159\\[hide-leaves] make body under heading and under its subheadings invisible.
160 The subheadings remain visible. 160 The subheadings remain visible.
161M-x show-branches make all subheadings at all levels visible. 161\\[show-branches] make all subheadings at all levels visible.
162 162
163The variable `outline-regexp' can be changed to control what is a heading. 163The variable `outline-regexp' can be changed to control what is a heading.
164A line is a heading if `outline-regexp' matches something at the 164A line is a heading if `outline-regexp' matches something at the
@@ -230,10 +230,10 @@ It can assume point is at the beginning of a header line.")
230(defun outline-level () 230(defun outline-level ()
231 "Return the depth to which a statement is nested in the outline. 231 "Return the depth to which a statement is nested in the outline.
232Point must be at the beginning of a header line. This is actually 232Point must be at the beginning of a header line. This is actually
233the column number of the end of what `outline-regexp matches'." 233the number of characters that `outline-regexp' matches."
234 (save-excursion 234 (save-excursion
235 (looking-at outline-regexp) 235 (looking-at outline-regexp)
236 (save-excursion (goto-char (match-end 0)) (current-column)))) 236 (- (match-end 0) (match-beginning 0))))
237 237
238(defun outline-next-preface () 238(defun outline-next-preface ()
239 "Skip forward to just before the next heading line." 239 "Skip forward to just before the next heading line."
@@ -256,13 +256,14 @@ the column number of the end of what `outline-regexp matches'."
256Only visible heading lines are considered." 256Only visible heading lines are considered."
257 (beginning-of-line) 257 (beginning-of-line)
258 (or (outline-on-heading-p) 258 (or (outline-on-heading-p)
259 (re-search-backward (concat "^\\(" outline-regexp "\\)") nil 'move))) 259 (re-search-backward (concat "^\\(" outline-regexp "\\)") nil t)
260 (error "before first heading")))
260 261
261(defun outline-on-heading-p () 262(defun outline-on-heading-p ()
262 "Return T if point is on a (visible) heading line." 263 "Return T if point is on a (visible) heading line."
263 (save-excursion 264 (save-excursion
264 (beginning-of-line) 265 (beginning-of-line)
265 (and (bobp) 266 (and (bolp)
266 (looking-at outline-regexp)))) 267 (looking-at outline-regexp))))
267 268
268(defun outline-end-of-heading () 269(defun outline-end-of-heading ()
@@ -278,7 +279,8 @@ A heading line is one that starts with a `*' (or that
278 (if (< arg 0) 279 (if (< arg 0)
279 (beginning-of-line) 280 (beginning-of-line)
280 (end-of-line)) 281 (end-of-line))
281 (re-search-forward (concat "^\\(" outline-regexp "\\)") nil nil arg) 282 (or (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t arg)
283 (error ""))
282 (beginning-of-line)) 284 (beginning-of-line))
283 285
284(defun outline-previous-visible-heading (arg) 286(defun outline-previous-visible-heading (arg)
@@ -357,7 +359,7 @@ while if FLAG is `\\^M' (control-M) the text is hidden."
357 (interactive) 359 (interactive)
358 (outline-flag-subtree ?\n)) 360 (outline-flag-subtree ?\n))
359 361
360(defun hide-sublevels (levels) 362(defun outline-hide-sublevels (levels)
361 "Hide everything except the top LEVELS levels of headers." 363 "Hide everything except the top LEVELS levels of headers."
362 (interactive "p") 364 (interactive "p")
363 (if (< levels 1) 365 (if (< levels 1)
@@ -365,6 +367,8 @@ while if FLAG is `\\^M' (control-M) the text is hidden."
365 (setq levels (1- levels)) 367 (setq levels (1- levels))
366 (save-excursion 368 (save-excursion
367 (goto-char (point-min)) 369 (goto-char (point-min))
370 (or (outline-on-heading-p)
371 (outline-next-heading))
368 (hide-subtree) 372 (hide-subtree)
369 (show-children levels) 373 (show-children levels)
370 (condition-case err 374 (condition-case err
@@ -373,7 +377,7 @@ while if FLAG is `\\^M' (control-M) the text is hidden."
373 (show-children levels)) 377 (show-children levels))
374 (error nil)))) 378 (error nil))))
375 379
376(defun hide-other () 380(defun outline-hide-other ()
377 "Hide everything except for the current body and the parent headings." 381 "Hide everything except for the current body and the parent headings."
378 (interactive) 382 (interactive)
379 (outline-hide-sublevels 1) 383 (outline-hide-sublevels 1)
@@ -412,7 +416,7 @@ while if FLAG is `\\^M' (control-M) the text is hidden."
412 nil 416 nil
413 ;; go to end of line before heading 417 ;; go to end of line before heading
414 (forward-char -1) 418 (forward-char -1)
415 ;; skip preceding balnk line, if there is one 419 ;; skip preceding blank line, if there is one
416 (if (memq (preceding-char) '(?\n ?\^M)) 420 (if (memq (preceding-char) '(?\n ?\^M))
417 (forward-char -1))))) 421 (forward-char -1)))))
418 422
@@ -464,13 +468,13 @@ With argument, move up ARG levels."
464 (outline-back-to-heading) 468 (outline-back-to-heading)
465 (if (eq (funcall outline-level) 1) 469 (if (eq (funcall outline-level) 1)
466 (error "")) 470 (error ""))
467 (while (and (> (funcall outline-level) 1) 471 (while (and (> (funcall outline-level) 1)
468 (> arg 0) 472 (> arg 0)
469 (not (bobp))) 473 (not (bobp)))
470 (let ((present-level (funcall outline-level))) 474 (let ((present-level (funcall outline-level)))
471 (while (not (< (funcall outline-level) present-level)) 475 (while (not (< (funcall outline-level) present-level))
472 (outline-previous-visible-heading 1)) 476 (outline-previous-visible-heading 1))
473 (setq arg (- arg 1))))) 477 (setq arg (- arg 1)))))
474 478
475(defun outline-forward-same-level (arg) 479(defun outline-forward-same-level (arg)
476 "Move forward to the ARG'th subheading from here of the same level as the 480 "Move forward to the ARG'th subheading from here of the same level as the