diff options
| author | Richard M. Stallman | 1993-08-14 09:13:23 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-14 09:13:23 +0000 |
| commit | 476731da98169a774e86cfcbf80651cdee98b590 (patch) | |
| tree | 5df515c0863d0b05d82b2aa59f49250ed0954236 | |
| parent | 6e301d2449a38b657cf3f93bbed7c1bd0fc774bf (diff) | |
| download | emacs-476731da98169a774e86cfcbf80651cdee98b590.tar.gz emacs-476731da98169a774e86cfcbf80651cdee98b590.zip | |
(outline-level): New var. Everything funcalls this
instead of calling outline-level.
| -rw-r--r-- | lisp/textmodes/ooutline.el | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/lisp/textmodes/ooutline.el b/lisp/textmodes/ooutline.el index c0c478cc179..4b7607dd5cc 100644 --- a/lisp/textmodes/ooutline.el +++ b/lisp/textmodes/ooutline.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; outline.el --- outline mode commands for Emacs | 1 | ;;; outline.el --- outline mode commands for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1986 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1986, 1993 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Maintainer: FSF | 5 | ;; Maintainer: FSF |
| 6 | 6 | ||
| @@ -196,6 +196,10 @@ See the command `outline-mode' for more information on this mode." | |||
| 196 | (run-hooks 'outline-minor-mode-hook)) | 196 | (run-hooks 'outline-minor-mode-hook)) |
| 197 | (setq selective-display nil))) | 197 | (setq selective-display nil))) |
| 198 | 198 | ||
| 199 | (defvar outline-level 'outline-level | ||
| 200 | "Function of no args to compute a header's nesting level in an outline. | ||
| 201 | It can assume point is at the beginning of a header line.") | ||
| 202 | |||
| 199 | (defun outline-level () | 203 | (defun outline-level () |
| 200 | "Return the depth to which a statement is nested in the outline. | 204 | "Return the depth to which a statement is nested in the outline. |
| 201 | Point must be at the beginning of a header line. This is actually | 205 | Point must be at the beginning of a header line. This is actually |
| @@ -337,9 +341,9 @@ while if FLAG is `\\^M' (control-M) the text is hidden." | |||
| 337 | (outline-back-to-heading) | 341 | (outline-back-to-heading) |
| 338 | (let ((opoint (point)) | 342 | (let ((opoint (point)) |
| 339 | (first t) | 343 | (first t) |
| 340 | (level (outline-level))) | 344 | (level (funcall outline-level))) |
| 341 | (while (and (not (eobp)) | 345 | (while (and (not (eobp)) |
| 342 | (or first (> (outline-level) level))) | 346 | (or first (> (funcall outline-level) level))) |
| 343 | (setq first nil) | 347 | (setq first nil) |
| 344 | (outline-next-heading)) | 348 | (outline-next-heading)) |
| 345 | (forward-char -1) | 349 | (forward-char -1) |
| @@ -360,13 +364,13 @@ Default is enough to cause the following heading to appear." | |||
| 360 | (if level (prefix-numeric-value level) | 364 | (if level (prefix-numeric-value level) |
| 361 | (save-excursion | 365 | (save-excursion |
| 362 | (beginning-of-line) | 366 | (beginning-of-line) |
| 363 | (let ((start-level (outline-level))) | 367 | (let ((start-level (funcall outline-level))) |
| 364 | (outline-next-heading) | 368 | (outline-next-heading) |
| 365 | (max 1 (- (outline-level) start-level)))))) | 369 | (max 1 (- (funcall outline-level) start-level)))))) |
| 366 | (save-excursion | 370 | (save-excursion |
| 367 | (save-restriction | 371 | (save-restriction |
| 368 | (beginning-of-line) | 372 | (beginning-of-line) |
| 369 | (setq level (+ level (outline-level))) | 373 | (setq level (+ level (funcall outline-level))) |
| 370 | (narrow-to-region (point) | 374 | (narrow-to-region (point) |
| 371 | (progn (outline-end-of-subtree) (1+ (point)))) | 375 | (progn (outline-end-of-subtree) (1+ (point)))) |
| 372 | (goto-char (point-min)) | 376 | (goto-char (point-min)) |
| @@ -374,7 +378,7 @@ Default is enough to cause the following heading to appear." | |||
| 374 | (progn | 378 | (progn |
| 375 | (outline-next-heading) | 379 | (outline-next-heading) |
| 376 | (not (eobp)))) | 380 | (not (eobp)))) |
| 377 | (if (<= (outline-level) level) | 381 | (if (<= (funcall outline-level) level) |
| 378 | (save-excursion | 382 | (save-excursion |
| 379 | (outline-flag-region (save-excursion | 383 | (outline-flag-region (save-excursion |
| 380 | (forward-char -1) | 384 | (forward-char -1) |
| @@ -389,13 +393,13 @@ Default is enough to cause the following heading to appear." | |||
| 389 | With argument, move up ARG levels." | 393 | With argument, move up ARG levels." |
| 390 | (interactive "p") | 394 | (interactive "p") |
| 391 | (outline-back-to-heading) | 395 | (outline-back-to-heading) |
| 392 | (if (eq (outline-level) 1) | 396 | (if (eq (funcall outline-level) 1) |
| 393 | (error "")) | 397 | (error "")) |
| 394 | (while (and (> (outline-level) 1) | 398 | (while (and (> (funcall outline-level) 1) |
| 395 | (> arg 0) | 399 | (> arg 0) |
| 396 | (not (bobp))) | 400 | (not (bobp))) |
| 397 | (let ((present-level (outline-level))) | 401 | (let ((present-level (funcall outline-level))) |
| 398 | (while (not (< (outline-level) present-level)) | 402 | (while (not (< (funcall outline-level) present-level)) |
| 399 | (outline-previous-visible-heading 1)) | 403 | (outline-previous-visible-heading 1)) |
| 400 | (setq arg (- arg 1))))) | 404 | (setq arg (- arg 1))))) |
| 401 | 405 | ||
| @@ -418,12 +422,12 @@ present one. It stops at the first and last subheadings of a superior heading." | |||
| 418 | (defun outline-get-next-sibling () | 422 | (defun outline-get-next-sibling () |
| 419 | "Position the point at the next heading of the same level, | 423 | "Position the point at the next heading of the same level, |
| 420 | and return that position or nil if it cannot be found." | 424 | and return that position or nil if it cannot be found." |
| 421 | (let ((level (outline-level))) | 425 | (let ((level (funcall outline-level))) |
| 422 | (outline-next-visible-heading 1) | 426 | (outline-next-visible-heading 1) |
| 423 | (while (and (> (outline-level) level) | 427 | (while (and (> (funcall outline-level) level) |
| 424 | (not (eobp))) | 428 | (not (eobp))) |
| 425 | (outline-next-visible-heading 1)) | 429 | (outline-next-visible-heading 1)) |
| 426 | (if (< (outline-level) level) | 430 | (if (< (funcall outline-level) level) |
| 427 | nil | 431 | nil |
| 428 | (point)))) | 432 | (point)))) |
| 429 | 433 | ||
| @@ -446,12 +450,12 @@ present one. It stops at the first and last subheadings of a superior heading." | |||
| 446 | (defun outline-get-last-sibling () | 450 | (defun outline-get-last-sibling () |
| 447 | "Position the point at the previous heading of the same level, | 451 | "Position the point at the previous heading of the same level, |
| 448 | and return that position or nil if it cannot be found." | 452 | and return that position or nil if it cannot be found." |
| 449 | (let ((level (outline-level))) | 453 | (let ((level (funcall outline-level))) |
| 450 | (outline-previous-visible-heading 1) | 454 | (outline-previous-visible-heading 1) |
| 451 | (while (and (> (outline-level) level) | 455 | (while (and (> (funcall outline-level) level) |
| 452 | (not (bobp))) | 456 | (not (bobp))) |
| 453 | (outline-previous-visible-heading 1)) | 457 | (outline-previous-visible-heading 1)) |
| 454 | (if (< (outline-level) level) | 458 | (if (< (funcall outline-level) level) |
| 455 | nil | 459 | nil |
| 456 | (point)))) | 460 | (point)))) |
| 457 | 461 | ||