diff options
| author | Stefan Monnier | 2000-11-23 00:04:36 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-11-23 00:04:36 +0000 |
| commit | 9cd5d49aee0d5652b4c696bcd3e51ebc5265788e (patch) | |
| tree | 1e0574464b17e30e859bc56f66f99bbab51f6cb5 | |
| parent | c607d53ddb3910a1f73083445323241d76af6f96 (diff) | |
| download | emacs-9cd5d49aee0d5652b4c696bcd3e51ebc5265788e.tar.gz emacs-9cd5d49aee0d5652b4c696bcd3e51ebc5265788e.zip | |
(outline-flag-region):
Don't bind inhibit-read-only since we don't modify the buffer.
(outline-isearch-open-invisible): Don't jump to overlay-start
since we're trying to unhide text around point.
(outline-discard-overlays): Use dolist.
| -rw-r--r-- | lisp/textmodes/outline.el | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/lisp/textmodes/outline.el b/lisp/textmodes/outline.el index a42d2a1013d..ed6f09864ac 100644 --- a/lisp/textmodes/outline.el +++ b/lisp/textmodes/outline.el | |||
| @@ -383,16 +383,15 @@ This puts point at the start of the current subtree, and mark at the end." | |||
| 383 | (defun outline-flag-region (from to flag) | 383 | (defun outline-flag-region (from to flag) |
| 384 | "Hides or shows lines from FROM to TO, according to FLAG. | 384 | "Hides or shows lines from FROM to TO, according to FLAG. |
| 385 | If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | 385 | If FLAG is nil then text is shown, while if FLAG is t the text is hidden." |
| 386 | (let ((inhibit-read-only t)) | 386 | (save-excursion |
| 387 | (save-excursion | 387 | (goto-char from) |
| 388 | (goto-char from) | 388 | (end-of-line) |
| 389 | (end-of-line) | 389 | (outline-discard-overlays (point) to 'outline) |
| 390 | (outline-discard-overlays (point) to 'outline) | 390 | (if flag |
| 391 | (if flag | 391 | (let ((o (make-overlay (point) to))) |
| 392 | (let ((o (make-overlay (point) to))) | 392 | (overlay-put o 'invisible 'outline) |
| 393 | (overlay-put o 'invisible 'outline) | 393 | (overlay-put o 'isearch-open-invisible |
| 394 | (overlay-put o 'isearch-open-invisible | 394 | 'outline-isearch-open-invisible)))) |
| 395 | 'outline-isearch-open-invisible))))) | ||
| 396 | (run-hooks 'outline-view-change-hook)) | 395 | (run-hooks 'outline-view-change-hook)) |
| 397 | 396 | ||
| 398 | 397 | ||
| @@ -400,9 +399,8 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | |||
| 400 | ;; to the overlay that makes the outline invisible (see | 399 | ;; to the overlay that makes the outline invisible (see |
| 401 | ;; `outline-flag-region'). | 400 | ;; `outline-flag-region'). |
| 402 | (defun outline-isearch-open-invisible (overlay) | 401 | (defun outline-isearch-open-invisible (overlay) |
| 403 | (save-excursion | 402 | ;; We rely on the fact that isearch places point one the matched text. |
| 404 | (goto-char (overlay-start overlay)) | 403 | (show-entry)) |
| 405 | (show-entry))) | ||
| 406 | 404 | ||
| 407 | 405 | ||
| 408 | ;; Exclude from the region BEG ... END all overlays | 406 | ;; Exclude from the region BEG ... END all overlays |
| @@ -414,26 +412,21 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | |||
| 414 | (if (< end beg) | 412 | (if (< end beg) |
| 415 | (setq beg (prog1 end (setq end beg)))) | 413 | (setq beg (prog1 end (setq end beg)))) |
| 416 | (save-excursion | 414 | (save-excursion |
| 417 | (let ((overlays (overlays-in beg end)) | 415 | (dolist (o (overlays-in beg end)) |
| 418 | o | 416 | (if (eq (overlay-get o 'invisible) prop) |
| 419 | o1) | 417 | ;; Either push this overlay outside beg...end |
| 420 | (while overlays | 418 | ;; or split it to exclude beg...end |
| 421 | (setq o (car overlays)) | 419 | ;; or delete it entirely (if it is contained in beg...end). |
| 422 | (if (eq (overlay-get o 'invisible) prop) | 420 | (if (< (overlay-start o) beg) |
| 423 | ;; Either push this overlay outside beg...end | ||
| 424 | ;; or split it to exclude beg...end | ||
| 425 | ;; or delete it entirely (if it is contained in beg...end). | ||
| 426 | (if (< (overlay-start o) beg) | ||
| 427 | (if (> (overlay-end o) end) | ||
| 428 | (progn | ||
| 429 | (setq o1 (outline-copy-overlay o)) | ||
| 430 | (move-overlay o1 (overlay-start o1) beg) | ||
| 431 | (move-overlay o end (overlay-end o))) | ||
| 432 | (move-overlay o (overlay-start o) beg)) | ||
| 433 | (if (> (overlay-end o) end) | 421 | (if (> (overlay-end o) end) |
| 434 | (move-overlay o end (overlay-end o)) | 422 | (progn |
| 435 | (delete-overlay o)))) | 423 | (move-overlay (outline-copy-overlay o) |
| 436 | (setq overlays (cdr overlays)))))) | 424 | (overlay-start o) beg) |
| 425 | (move-overlay o end (overlay-end o))) | ||
| 426 | (move-overlay o (overlay-start o) beg)) | ||
| 427 | (if (> (overlay-end o) end) | ||
| 428 | (move-overlay o end (overlay-end o)) | ||
| 429 | (delete-overlay o)))))))) | ||
| 437 | 430 | ||
| 438 | ;; Make a copy of overlay O, with the same beginning, end and properties. | 431 | ;; Make a copy of overlay O, with the same beginning, end and properties. |
| 439 | (defun outline-copy-overlay (o) | 432 | (defun outline-copy-overlay (o) |