Mercurial > emacs
annotate lisp/ebuff-menu.el @ 97872:6e47522fd758
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 30 Aug 2008 13:06:15 +0000 |
parents | ee5932bf781d |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
475
diff
changeset
|
1 ;;; ebuff-menu.el --- electric-buffer-list mode |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
475
diff
changeset
|
2 |
74439 | 3 ;; Copyright (C) 1985, 1986, 1994, 2001, 2002, 2003, 2004, |
79721 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
5 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
6 ;; Author: Richard Mlynarik <mly@ai.mit.edu> |
21045 | 7 ;; Maintainer: FSF |
31559 | 8 ;; Keywords: convenience |
475 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
475 | 13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
475 | 16 |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
475 | 24 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
25 ;;; Commentary: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
26 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2026
diff
changeset
|
27 ;; Who says one can't have typeout windows in GNU Emacs? The entry |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2026
diff
changeset
|
28 ;; point, `electric-buffer-list' works like ^r select buffer from the |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2026
diff
changeset
|
29 ;; ITS Emacs lunar or tmacs libraries. |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
30 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
31 ;;; Code: |
475 | 32 |
33 (require 'electric) | |
34 | |
35 ;; this depends on the format of list-buffers (from src/buffer.c) and | |
36 ;; on stuff in lisp/buff-menu.el | |
37 | |
38 (defvar electric-buffer-menu-mode-map nil) | |
39 | |
58120 | 40 (defvar electric-buffer-menu-mode-hook nil |
41 "Normal hook run by `electric-buffer-list'.") | |
42 | |
475 | 43 ;;;###autoload |
44 (defun electric-buffer-list (arg) | |
58120 | 45 "Pop up a buffer describing the set of Emacs buffers. |
475 | 46 Vaguely like ITS lunar select buffer; combining typeoutoid buffer |
47 listing with menuoid buffer selection. | |
48 | |
49 If the very next character typed is a space then the buffer list | |
50 window disappears. Otherwise, one may move around in the buffer list | |
51 window, marking buffers to be selected, saved or deleted. | |
52 | |
53 To exit and select a new buffer, type a space when the cursor is on | |
54 the appropriate line of the buffer-list window. Other commands are | |
58120 | 55 much like those of `Buffer-menu-mode'. |
475 | 56 |
58120 | 57 Run hooks in `electric-buffer-menu-mode-hook' on entry. |
475 | 58 |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41016
diff
changeset
|
59 \\{electric-buffer-menu-mode-map}" |
475 | 60 (interactive "P") |
61 (let (select buffer) | |
62 (save-window-excursion | |
38928
86b624b00b77
(electric-buffer-list): Use list-buffers-noselect.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31559
diff
changeset
|
63 (setq buffer (list-buffers-noselect arg)) |
86b624b00b77
(electric-buffer-list): Use list-buffers-noselect.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31559
diff
changeset
|
64 (Electric-pop-up-window buffer) |
475 | 65 (unwind-protect |
66 (progn | |
67 (set-buffer buffer) | |
68 (Electric-buffer-menu-mode) | |
41016
7cbfb84f7362
(electric-buffer-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38928
diff
changeset
|
69 (electric-buffer-update-highlight) |
475 | 70 (setq select |
71 (catch 'electric-buffer-menu-select | |
8122
2fae14e8ae5d
(electric-buffer-list): Change prompt message.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
72 (message "<<< Press Return to bury the buffer list >>>") |
2026
3514a9bf50c5
(electric-buffer-list): Handle any kind of event.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
73 (if (eq (setq unread-command-events (list (read-event))) |
74225
5a4b0f0ec24a
(electric-buffer-list): "?\ " -> "?\s".
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
74 ?\s) |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1607
diff
changeset
|
75 (progn (setq unread-command-events nil) |
475 | 76 (throw 'electric-buffer-menu-select nil))) |
12568
94ee086557db
(electric-buffer-list): Save point before
Karl Heuer <kwzh@gnu.org>
parents:
11275
diff
changeset
|
77 (let ((start-point (point)) |
94ee086557db
(electric-buffer-list): Save point before
Karl Heuer <kwzh@gnu.org>
parents:
11275
diff
changeset
|
78 (first (progn (goto-char (point-min)) |
50035
af49d6f1e6cc
(electric-buffer-list): Respect `Buffer-menu-use-header-line'.
John Paul Wallington <jpw@pobox.com>
parents:
49588
diff
changeset
|
79 (unless Buffer-menu-use-header-line |
af49d6f1e6cc
(electric-buffer-list): Respect `Buffer-menu-use-header-line'.
John Paul Wallington <jpw@pobox.com>
parents:
49588
diff
changeset
|
80 (forward-line 2)) |
475 | 81 (point))) |
82 (last (progn (goto-char (point-max)) | |
83 (forward-line -1) | |
84 (point))) | |
85 (goal-column 0)) | |
12568
94ee086557db
(electric-buffer-list): Save point before
Karl Heuer <kwzh@gnu.org>
parents:
11275
diff
changeset
|
86 ;; Use start-point if it is meaningful. |
94ee086557db
(electric-buffer-list): Save point before
Karl Heuer <kwzh@gnu.org>
parents:
11275
diff
changeset
|
87 (goto-char (if (or (< start-point first) |
94ee086557db
(electric-buffer-list): Save point before
Karl Heuer <kwzh@gnu.org>
parents:
11275
diff
changeset
|
88 (> start-point last)) |
94ee086557db
(electric-buffer-list): Save point before
Karl Heuer <kwzh@gnu.org>
parents:
11275
diff
changeset
|
89 first |
94ee086557db
(electric-buffer-list): Save point before
Karl Heuer <kwzh@gnu.org>
parents:
11275
diff
changeset
|
90 start-point)) |
475 | 91 (Electric-command-loop 'electric-buffer-menu-select |
92 nil | |
93 t | |
94 'electric-buffer-menu-looper | |
95 (cons first last)))))) | |
96 (set-buffer buffer) | |
97 (Buffer-menu-mode) | |
98 (bury-buffer buffer) | |
99 (message ""))) | |
100 (if select | |
101 (progn (set-buffer buffer) | |
102 (let ((opoint (point-marker))) | |
103 (Buffer-menu-execute) | |
104 (goto-char (point-min)) | |
105 (if (prog1 (search-forward "\n>" nil t) | |
106 (goto-char opoint) (set-marker opoint nil)) | |
107 (Buffer-menu-select) | |
108 (switch-to-buffer (Buffer-menu-buffer t)))))))) | |
109 | |
110 (defun electric-buffer-menu-looper (state condition) | |
111 (cond ((and condition | |
112 (not (memq (car condition) '(buffer-read-only | |
113 end-of-buffer | |
114 beginning-of-buffer)))) | |
115 (signal (car condition) (cdr condition))) | |
116 ((< (point) (car state)) | |
117 (goto-char (point-min)) | |
50035
af49d6f1e6cc
(electric-buffer-list): Respect `Buffer-menu-use-header-line'.
John Paul Wallington <jpw@pobox.com>
parents:
49588
diff
changeset
|
118 (unless Buffer-menu-use-header-line |
af49d6f1e6cc
(electric-buffer-list): Respect `Buffer-menu-use-header-line'.
John Paul Wallington <jpw@pobox.com>
parents:
49588
diff
changeset
|
119 (forward-line 2))) |
475 | 120 ((> (point) (cdr state)) |
121 (goto-char (point-max)) | |
122 (forward-line -1) | |
123 (if (pos-visible-in-window-p (point-max)) | |
41016
7cbfb84f7362
(electric-buffer-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38928
diff
changeset
|
124 (recenter -1)))) |
7cbfb84f7362
(electric-buffer-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38928
diff
changeset
|
125 (electric-buffer-update-highlight)) |
475 | 126 |
64798
b61d2aa00716
(Helper-return-blurb): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
127 (defvar Helper-return-blurb) |
b61d2aa00716
(Helper-return-blurb): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
64762
diff
changeset
|
128 |
475 | 129 (put 'Electric-buffer-menu-mode 'mode-class 'special) |
130 (defun Electric-buffer-menu-mode () | |
131 "Major mode for editing a list of buffers. | |
132 Each line describes one of the buffers in Emacs. | |
133 Letters do not insert themselves; instead, they are commands. | |
134 \\<electric-buffer-menu-mode-map> | |
135 \\[keyboard-quit] or \\[Electric-buffer-menu-quit] -- exit buffer menu, returning to previous window and buffer | |
136 configuration. If the very first character typed is a space, it | |
137 also has this effect. | |
138 \\[Electric-buffer-menu-select] -- select buffer of line point is on. | |
139 Also show buffers marked with m in other windows, | |
140 deletes buffers marked with \"D\", and saves those marked with \"S\". | |
141 \\[Buffer-menu-mark] -- mark buffer to be displayed. | |
142 \\[Buffer-menu-not-modified] -- clear modified-flag on that buffer. | |
143 \\[Buffer-menu-save] -- mark that buffer to be saved. | |
144 \\[Buffer-menu-delete] or \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted. | |
145 \\[Buffer-menu-unmark] -- remove all kinds of marks from current line. | |
146 \\[Electric-buffer-menu-mode-view-buffer] -- view buffer, returning when done. | |
147 \\[Buffer-menu-backup-unmark] -- back up a line and remove marks. | |
148 | |
149 \\{electric-buffer-menu-mode-map} | |
150 | |
58120 | 151 Entry to this mode via command `electric-buffer-list' calls the value of |
152 `electric-buffer-menu-mode-hook'." | |
59453
1312906d3476
(Electric-buffer-menu-mode):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
58120
diff
changeset
|
153 (let ((saved header-line-format)) |
1312906d3476
(Electric-buffer-menu-mode):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
58120
diff
changeset
|
154 (kill-all-local-variables) |
1312906d3476
(Electric-buffer-menu-mode):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
58120
diff
changeset
|
155 (setq header-line-format saved)) |
475 | 156 (use-local-map electric-buffer-menu-mode-map) |
157 (setq mode-name "Electric Buffer Menu") | |
158 (setq mode-line-buffer-identification "Electric Buffer List") | |
159 (make-local-variable 'Helper-return-blurb) | |
160 (setq Helper-return-blurb "return to buffer editing") | |
161 (setq truncate-lines t) | |
162 (setq buffer-read-only t) | |
163 (setq major-mode 'Electric-buffer-menu-mode) | |
164 (goto-char (point-min)) | |
165 (if (search-forward "\n." nil t) (forward-char -1)) | |
62726
3b4e0fdb401f
(Electric-buffer-menu-mode): Use run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
59453
diff
changeset
|
166 (run-mode-hooks 'electric-buffer-menu-mode-hook)) |
475 | 167 |
168 ;; generally the same as Buffer-menu-mode-map | |
169 ;; (except we don't indirect to global-map) | |
170 (put 'Electric-buffer-menu-undefined 'suppress-keymap t) | |
171 (if electric-buffer-menu-mode-map | |
172 nil | |
23007
62da6fd2d526
(electric-buffer-menu-mode-map): Don't wipe out all Meta keys.
Richard M. Stallman <rms@gnu.org>
parents:
21045
diff
changeset
|
173 (let ((map (make-keymap))) |
2397
2b34a2ef4d63
(electric-buffer-menu-mode-map): fillarray isn't a valid operation on maps
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
174 (fillarray (car (cdr map)) 'Electric-buffer-menu-undefined) |
23007
62da6fd2d526
(electric-buffer-menu-mode-map): Don't wipe out all Meta keys.
Richard M. Stallman <rms@gnu.org>
parents:
21045
diff
changeset
|
175 (define-key map "\e" nil) |
83416
4513d8dcdfd5
Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents:
64798
diff
changeset
|
176 (define-key map "\C-z" 'suspend-frame) |
475 | 177 (define-key map "v" 'Electric-buffer-menu-mode-view-buffer) |
918
94b50bbd43c3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
917
diff
changeset
|
178 (define-key map (char-to-string help-char) 'Helper-help) |
475 | 179 (define-key map "?" 'Helper-describe-bindings) |
180 (define-key map "\C-c" nil) | |
181 (define-key map "\C-c\C-c" 'Electric-buffer-menu-quit) | |
182 (define-key map "\C-]" 'Electric-buffer-menu-quit) | |
183 (define-key map "q" 'Electric-buffer-menu-quit) | |
184 (define-key map " " 'Electric-buffer-menu-select) | |
8122
2fae14e8ae5d
(electric-buffer-list): Change prompt message.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
185 (define-key map "\C-m" 'Electric-buffer-menu-select) |
475 | 186 (define-key map "\C-l" 'recenter) |
187 (define-key map "s" 'Buffer-menu-save) | |
188 (define-key map "d" 'Buffer-menu-delete) | |
189 (define-key map "k" 'Buffer-menu-delete) | |
190 (define-key map "\C-d" 'Buffer-menu-delete-backwards) | |
191 ;(define-key map "\C-k" 'Buffer-menu-delete) | |
192 (define-key map "\177" 'Buffer-menu-backup-unmark) | |
193 (define-key map "~" 'Buffer-menu-not-modified) | |
194 (define-key map "u" 'Buffer-menu-unmark) | |
195 (let ((i ?0)) | |
196 (while (<= i ?9) | |
197 (define-key map (char-to-string i) 'digit-argument) | |
198 (define-key map (concat "\e" (char-to-string i)) 'digit-argument) | |
199 (setq i (1+ i)))) | |
200 (define-key map "-" 'negative-argument) | |
201 (define-key map "\e-" 'negative-argument) | |
202 (define-key map "m" 'Buffer-menu-mark) | |
203 (define-key map "\C-u" 'universal-argument) | |
204 (define-key map "\C-p" 'previous-line) | |
205 (define-key map "\C-n" 'next-line) | |
206 (define-key map "p" 'previous-line) | |
207 (define-key map "n" 'next-line) | |
208 (define-key map "\C-v" 'scroll-up) | |
209 (define-key map "\ev" 'scroll-down) | |
210 (define-key map ">" 'scroll-right) | |
211 (define-key map "<" 'scroll-left) | |
212 (define-key map "\e\C-v" 'scroll-other-window) | |
213 (define-key map "\e>" 'end-of-buffer) | |
214 (define-key map "\e<" 'beginning-of-buffer) | |
11275
53f0ebe096f5
(electric-buffer-menu-mode-map): Undefine ESC ESC
Richard M. Stallman <rms@gnu.org>
parents:
10115
diff
changeset
|
215 (define-key map "\e\e" nil) |
10115
e55ee438bd10
(electric-buffer-menu-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
8122
diff
changeset
|
216 (define-key map "\e\e\e" 'Electric-buffer-menu-quit) |
e55ee438bd10
(electric-buffer-menu-mode-map):
Richard M. Stallman <rms@gnu.org>
parents:
8122
diff
changeset
|
217 (define-key map [escape escape escape] 'Electric-buffer-menu-quit) |
7006
5f1e5be68fcd
(Electric-buffer-menu-mouse-select): New function.
Karl Heuer <kwzh@gnu.org>
parents:
2397
diff
changeset
|
218 (define-key map [mouse-2] 'Electric-buffer-menu-mouse-select) |
475 | 219 (setq electric-buffer-menu-mode-map map))) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41016
diff
changeset
|
220 |
475 | 221 (defun Electric-buffer-menu-exit () |
222 (interactive) | |
2026
3514a9bf50c5
(electric-buffer-list): Handle any kind of event.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
223 (setq unread-command-events (listify-key-sequence (this-command-keys))) |
475 | 224 ;; for robustness |
225 (condition-case () | |
226 (throw 'electric-buffer-menu-select nil) | |
227 (error (Buffer-menu-mode) | |
228 (other-buffer)))) | |
229 | |
230 (defun Electric-buffer-menu-select () | |
231 "Leave Electric Buffer Menu, selecting buffers and executing changes. | |
58120 | 232 Save buffers marked \"S\". Delete buffers marked \"K\". |
233 Select buffer at point and display buffers marked \">\" in other windows." | |
475 | 234 (interactive) |
235 (throw 'electric-buffer-menu-select (point))) | |
236 | |
7006
5f1e5be68fcd
(Electric-buffer-menu-mouse-select): New function.
Karl Heuer <kwzh@gnu.org>
parents:
2397
diff
changeset
|
237 (defun Electric-buffer-menu-mouse-select (event) |
5f1e5be68fcd
(Electric-buffer-menu-mouse-select): New function.
Karl Heuer <kwzh@gnu.org>
parents:
2397
diff
changeset
|
238 (interactive "e") |
5f1e5be68fcd
(Electric-buffer-menu-mouse-select): New function.
Karl Heuer <kwzh@gnu.org>
parents:
2397
diff
changeset
|
239 (select-window (posn-window (event-end event))) |
5f1e5be68fcd
(Electric-buffer-menu-mouse-select): New function.
Karl Heuer <kwzh@gnu.org>
parents:
2397
diff
changeset
|
240 (set-buffer (window-buffer (selected-window))) |
5f1e5be68fcd
(Electric-buffer-menu-mouse-select): New function.
Karl Heuer <kwzh@gnu.org>
parents:
2397
diff
changeset
|
241 (goto-char (posn-point (event-end event))) |
5f1e5be68fcd
(Electric-buffer-menu-mouse-select): New function.
Karl Heuer <kwzh@gnu.org>
parents:
2397
diff
changeset
|
242 (throw 'electric-buffer-menu-select (point))) |
5f1e5be68fcd
(Electric-buffer-menu-mouse-select): New function.
Karl Heuer <kwzh@gnu.org>
parents:
2397
diff
changeset
|
243 |
475 | 244 (defun Electric-buffer-menu-quit () |
245 "Leave Electric Buffer Menu, restoring previous window configuration. | |
58120 | 246 Skip execution of select, save, and delete commands." |
475 | 247 (interactive) |
248 (throw 'electric-buffer-menu-select nil)) | |
249 | |
250 (defun Electric-buffer-menu-undefined () | |
251 (interactive) | |
252 (ding) | |
14310
49af6e2bfaa8
(Electric-buffer-menu-undefined): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
253 (message "%s" |
49af6e2bfaa8
(Electric-buffer-menu-undefined): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
254 (if (and (eq (key-binding "\C-c\C-c") 'Electric-buffer-menu-quit) |
475 | 255 (eq (key-binding " ") 'Electric-buffer-menu-select) |
919 | 256 (eq (key-binding (char-to-string help-char)) 'Helper-help) |
475 | 257 (eq (key-binding "?") 'Helper-describe-bindings)) |
916
938f166a0874
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
915
diff
changeset
|
258 (substitute-command-keys "Type C-c C-c to exit, Space to select, \\[Helper-help] for help, ? for commands") |
475 | 259 (substitute-command-keys "\ |
260 Type \\[Electric-buffer-menu-quit] to exit, \ | |
261 \\[Electric-buffer-menu-select] to select, \ | |
262 \\[Helper-help] for help, \\[Helper-describe-bindings] for commands."))) | |
263 (sit-for 4)) | |
264 | |
265 (defun Electric-buffer-menu-mode-view-buffer () | |
266 "View buffer on current line in Electric Buffer Menu. | |
58120 | 267 Return to Electric Buffer Menu when done." |
475 | 268 (interactive) |
269 (let ((bufnam (Buffer-menu-buffer nil))) | |
270 (if bufnam | |
271 (view-buffer bufnam) | |
272 (ding) | |
273 (message "Buffer %s does not exist!" bufnam) | |
274 (sit-for 4)))) | |
275 | |
41016
7cbfb84f7362
(electric-buffer-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38928
diff
changeset
|
276 (defvar electric-buffer-overlay nil) |
7cbfb84f7362
(electric-buffer-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38928
diff
changeset
|
277 (defun electric-buffer-update-highlight () |
50068
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
278 (when (eq major-mode 'Electric-buffer-menu-mode) |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
279 ;; Make sure we have an overlay to use. |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
280 (or electric-buffer-overlay |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
281 (progn |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
282 (make-local-variable 'electric-buffer-overlay) |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
283 (setq electric-buffer-overlay (make-overlay (point) (point))))) |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
284 (move-overlay electric-buffer-overlay |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
285 (save-excursion (beginning-of-line) (point)) |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
286 (save-excursion (end-of-line) (point))) |
9fa70ec97b76
(electric-buffer-update-highlight): Do nothing
John Paul Wallington <jpw@pobox.com>
parents:
50035
diff
changeset
|
287 (overlay-put electric-buffer-overlay 'face 'highlight))) |
41016
7cbfb84f7362
(electric-buffer-update-highlight): New function.
Richard M. Stallman <rms@gnu.org>
parents:
38928
diff
changeset
|
288 |
18383 | 289 (provide 'ebuff-menu) |
290 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
291 ;; arch-tag: 1d4509b3-eece-4d4f-95ea-77c83eaf0275 |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
475
diff
changeset
|
292 ;;; ebuff-menu.el ends here |