annotate lisp/reveal.el @ 46205:6676ac71682b

Update mouse button info. Don't give the names of Emacs commands that the characters run. Clarify what SPC and DEL do. Clarify the description of the minibuffer. Wording change for completion. Explain Mouse-2 better.
author Richard M. Stallman <rms@gnu.org>
date Sun, 07 Jul 2002 11:31:31 +0000
parents ac7e0cc03aed
children 59fc5f077731
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
1 ;;; reveal.el --- Automatically reveal hidden text at point
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
2
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
3 ;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
4
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
5 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
6 ;; Keywords: outlines
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
7
42320
44b4a14ae7fc Fix Lisp headers.
Pavel Janík <Pavel@Janik.cz>
parents: 41778
diff changeset
8 ;; This file is part of GNU Emacs.
44b4a14ae7fc Fix Lisp headers.
Pavel Janík <Pavel@Janik.cz>
parents: 41778
diff changeset
9
45340
a0cc96a3bf71 Fix the preamble comments.
Eli Zaretskii <eliz@gnu.org>
parents: 42320
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
13 ;; any later version.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
14
45341
1471d94c6f8a More preamble fixes.
Eli Zaretskii <eliz@gnu.org>
parents: 45340
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
18 ;; GNU General Public License for more details.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
19
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
24
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
25 ;;; Commentary:
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
26
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
27 ;; Reveal mode is a minor mode that makes sure that text around point
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
28 ;; is always visible. When point enters a region of hidden text,
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
29 ;; `reveal-mode' temporarily makes it visible.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
30 ;;
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
31 ;; This is normally used in conjunction with `outline-minor-mode',
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
32 ;; `hs-minor-mode', `hide-ifdef-mode', ...
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
33 ;;
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
34 ;; It only works with packages that hide text using overlays.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
35 ;; Packages can provide special support for it by placing
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
36 ;; a function in the `reveal-toggle-invisible' property on the symbol
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
37 ;; used as the value of the `invisible' overlay property.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
38 ;; The function is called right after revealing (or re-hiding) the
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
39 ;; text with two arguments: the overlay and a boolean that's non-nil
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
40 ;; if we have just revealed the text. When revealing, that function
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
41 ;; may re-hide some of the text.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
42
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
43 ;;; Todo:
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
44
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
45 ;; - find other hysteresis features.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
46
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
47 ;;; Code:
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
48
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
49 (require 'pcvs-util)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
50
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
51 (defgroup reveal nil
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
52 "Reveal hidden text on the fly."
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
53 :group 'editing)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
54
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
55 (defcustom reveal-around-mark t
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
56 "Reveal text around the mark, if active."
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
57 :type 'boolean)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
58
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
59 (defvar reveal-open-spots nil)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
60 (make-variable-buffer-local 'reveal-open-spots)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
61
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
62 ;; Actual code
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
63
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
64 (defun reveal-post-command ()
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
65 ;; Refresh the spots that might have changed.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
66 ;; `Refreshing' here means to try and re-hide the corresponding text.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
67 ;; We don't refresh everything correctly:
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
68 ;; - we only refresh spots in the current window.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
69 ;; FIXME: do we actually know that (current-buffer) = (window-buffer) ?
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
70 (with-local-quit
45428
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
71 (condition-case err
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
72 (let* ((spots (cvs-partition
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
73 (lambda (x)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
74 ;; We refresh any spot in the current window as well
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
75 ;; as any spots associated with a dead window or a window
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
76 ;; which does not show this buffer any more.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
77 (or (eq (car x) (selected-window))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
78 (not (window-live-p (car x)))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
79 (not (eq (window-buffer (car x))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
80 (current-buffer)))))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
81 reveal-open-spots))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
82 (old-ols (mapcar 'cdr (car spots)))
45428
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
83 (repeat t))
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
84 (setq reveal-open-spots (cdr spots))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
85 ;; Open new overlays.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
86 (while repeat
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
87 (setq repeat nil)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
88 (dolist (ol (nconc (when (and reveal-around-mark mark-active)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
89 (overlays-at (mark)))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
90 (overlays-at (point))))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
91 (push (cons (selected-window) ol) reveal-open-spots)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
92 (setq old-ols (delq ol old-ols))
45428
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
93 (let ((open (overlay-get ol 'reveal-toggle-invisible)))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
94 (when (or open
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
95 (let ((inv (overlay-get ol 'invisible)))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
96 (and inv (symbolp inv)
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
97 (or (setq open (or (get inv 'reveal-toggle-invisible)
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
98 (get ol 'isearch-open-invisible-temporary)))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
99 (overlay-get ol 'isearch-open-invisible)
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
100 (and (consp buffer-invisibility-spec)
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
101 (assq inv buffer-invisibility-spec)))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
102 (overlay-put ol 'reveal-invisible inv))))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
103 (if (null open)
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
104 (overlay-put ol 'invisible nil)
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
105 ;; Use the provided opening function and repeat (since the
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
106 ;; opening function might have hidden a subpart around point).
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
107 (setq repeat t)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
108 (condition-case err
45428
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
109 (funcall open ol nil)
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
110 (error (message "!!Reveal-show: %s !!" err))))))))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
111 ;; Close old overlays.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
112 (dolist (ol old-ols)
45428
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
113 (when (and (eq (current-buffer) (overlay-buffer ol))
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
114 (not (rassq ol reveal-open-spots)))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
115 (if (and (>= (point) (save-excursion
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
116 (goto-char (overlay-start ol))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
117 (line-beginning-position 1)))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
118 (<= (point) (save-excursion
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
119 (goto-char (overlay-end ol))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
120 (line-beginning-position 2))))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
121 ;; Still near the overlay: keep it open.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
122 (push (cons (selected-window) ol) reveal-open-spots)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
123 ;; Really close it.
45428
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
124 (let ((open (overlay-get ol 'reveal-toggle-invisible)) inv)
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
125 (if (or open
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
126 (and (setq inv (overlay-get ol 'reveal-invisible))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
127 (setq open (or (get inv 'reveal-toggle-invisible)
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
128 (get ol 'isearch-open-invisible-temporary)))))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
129 (condition-case err
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
130 (funcall open ol t)
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
131 (error (message "!!Reveal-hide: %s !!" err)))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
132 (overlay-put ol 'invisible inv)))))))
ac7e0cc03aed (reveal-post-command): Reverse the semantics of
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 45341
diff changeset
133 (error (message "Reveal: %s" err)))))
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
134
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
135 ;;;###autoload
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
136 (define-minor-mode reveal-mode
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
137 "Toggle Reveal mode on or off.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
138 Reveal mode renders invisible text around point visible again.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
139
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
140 Interactively, with no prefix argument, toggle the mode.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
141 With universal prefix ARG (or if ARG is nil) turn mode on.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
142 With zero or negative ARG turn mode off."
41778
19e76eadbf86 (reveal-mode): Fix reveal-mode's lighter.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 41621
diff changeset
143 :lighter (global-reveal-mode nil " Reveal")
41621
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
144 (if reveal-mode
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
145 (progn
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
146 (set (make-local-variable 'search-invisible) t)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
147 (add-hook 'post-command-hook 'reveal-post-command nil t))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
148 (kill-local-variable 'search-invisible)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
149 (remove-hook 'post-command-hook 'reveal-post-command t)))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
150
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
151 ;;;###autoload
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
152 (define-minor-mode global-reveal-mode
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
153 "Toggle Reveal mode in all buffers on or off.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
154 Reveal mode renders invisible text around point visible again.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
155
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
156 Interactively, with no prefix argument, toggle the mode.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
157 With universal prefix ARG (or if ARG is nil) turn mode on.
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
158 With zero or negative ARG turn mode off."
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
159 :global t
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
160 (setq-default reveal-mode global-reveal-mode)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
161 (if global-reveal-mode
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
162 (progn
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
163 (setq search-invisible t)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
164 (add-hook 'post-command-hook 'reveal-post-command))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
165 (setq search-invisible 'open) ;FIXME
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
166 (remove-hook 'post-command-hook 'reveal-post-command)))
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
167
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
168 (provide 'reveal)
8835d207e12a Initial commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff changeset
169 ;;; reveal.el ends here