Mercurial > emacs
annotate lisp/buff-menu.el @ 10223:97fc8c6b4a74
(XTupdate_begin): Discard records of prior mouse highlight
when frame must be redrawn.
(x_make_frame_visible, x_make_frame_invisible)
(x_iconify_frame): Give error if frame has explicit_parent.
(x_new_font): Don't set window height if frame has explicit_parent.
(x_mouse_leave): New function broken out of XTread_socket.
When x_focus_event_frame is nonzero, assume that frame gets focus.
(XTread_socket): Use x_mouse_leave for LeaveNotify.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 23 Dec 1994 05:12:32 +0000 |
parents | d59e8878ccca |
children | 988517b0b62a |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
194
diff
changeset
|
1 ;;; buff-menu.el --- buffer menu main function and support functions. |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
194
diff
changeset
|
2 |
7298 | 3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc. |
845 | 4 |
801
e9e34745ae3b
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
5 ;; Maintainer: FSF |
194 | 6 |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
735 | 11 ;; the Free Software Foundation; either version 2, or (at your option) |
194 | 12 ;; any later version. |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
22 | |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
23 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
24 |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
25 ;; Edit, delete, or change attributes of all currently active Emacs |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2736
diff
changeset
|
26 ;; buffers from a list summarizing their state. A good way to browse |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
27 ;; any special or scratch buffers you have loaded, since you can't find |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
28 ;; them by filename. The single entry point is `Buffer-menu-mode', |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
29 ;; normally bound to C-x C-b. |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
30 |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
31 ;;; Change Log: |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
32 |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
33 ;; Merged by esr with recent mods to Emacs 19 buff-menu, 23 Mar 1993 |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
34 ;; |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
35 ;; Modified by Bob Weiner, Motorola, Inc., 4/14/89 |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
36 ;; |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
37 ;; Added optional backup argument to 'Buffer-menu-unmark' to make it undelete |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
38 ;; current entry and then move to previous one. |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
39 ;; |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
40 ;; Based on FSF code dating back to 1985. |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
41 |
801
e9e34745ae3b
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
42 ;;; Code: |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
43 |
2736
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
44 ;;;Not needed, now that q is now just quit and Buffer-menu-select is v. |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
45 ;;;(defvar Buffer-menu-window-config nil |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
46 ;;; "Window configuration saved from entry to `buffer-menu'.") |
194 | 47 |
48 ; Put buffer *Buffer List* into proper mode right away | |
49 ; so that from now on even list-buffers is enough to get a buffer menu. | |
50 | |
6640
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
51 (defvar Buffer-menu-buffer-column nil) |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
52 |
194 | 53 (defvar Buffer-menu-mode-map nil "") |
54 | |
55 (if Buffer-menu-mode-map | |
56 () | |
57 (setq Buffer-menu-mode-map (make-keymap)) | |
58 (suppress-keymap Buffer-menu-mode-map t) | |
2736
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
59 (define-key Buffer-menu-mode-map "q" 'Buffer-menu-quit) |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
60 (define-key Buffer-menu-mode-map "v" 'Buffer-menu-select) |
194 | 61 (define-key Buffer-menu-mode-map "2" 'Buffer-menu-2-window) |
62 (define-key Buffer-menu-mode-map "1" 'Buffer-menu-1-window) | |
63 (define-key Buffer-menu-mode-map "f" 'Buffer-menu-this-window) | |
64 (define-key Buffer-menu-mode-map "o" 'Buffer-menu-other-window) | |
735 | 65 (define-key Buffer-menu-mode-map "\C-o" 'Buffer-menu-switch-other-window) |
194 | 66 (define-key Buffer-menu-mode-map "s" 'Buffer-menu-save) |
67 (define-key Buffer-menu-mode-map "d" 'Buffer-menu-delete) | |
68 (define-key Buffer-menu-mode-map "k" 'Buffer-menu-delete) | |
69 (define-key Buffer-menu-mode-map "\C-d" 'Buffer-menu-delete-backwards) | |
70 (define-key Buffer-menu-mode-map "\C-k" 'Buffer-menu-delete) | |
71 (define-key Buffer-menu-mode-map "x" 'Buffer-menu-execute) | |
72 (define-key Buffer-menu-mode-map " " 'next-line) | |
73 (define-key Buffer-menu-mode-map "n" 'next-line) | |
74 (define-key Buffer-menu-mode-map "p" 'previous-line) | |
75 (define-key Buffer-menu-mode-map "\177" 'Buffer-menu-backup-unmark) | |
76 (define-key Buffer-menu-mode-map "~" 'Buffer-menu-not-modified) | |
77 (define-key Buffer-menu-mode-map "?" 'describe-mode) | |
78 (define-key Buffer-menu-mode-map "u" 'Buffer-menu-unmark) | |
79 (define-key Buffer-menu-mode-map "m" 'Buffer-menu-mark) | |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
80 (define-key Buffer-menu-mode-map "t" 'Buffer-menu-visit-tags-table) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
81 (define-key Buffer-menu-mode-map "%" 'Buffer-menu-toggle-read-only) |
8161
6b104526819d
(Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7659
diff
changeset
|
82 (define-key Buffer-menu-mode-map "g" 'revert-buffer) |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
83 (define-key Buffer-menu-mode-map [mouse-2] 'Buffer-menu-mouse-select) |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
84 ) |
194 | 85 |
86 ;; Buffer Menu mode is suitable only for specially formatted data. | |
87 (put 'Buffer-menu-mode 'mode-class 'special) | |
88 | |
89 (defun Buffer-menu-mode () | |
90 "Major mode for editing a list of buffers. | |
91 Each line describes one of the buffers in Emacs. | |
92 Letters do not insert themselves; instead, they are commands. | |
93 \\<Buffer-menu-mode-map> | |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
94 \\[Buffer-menu-mouse-select] -- select buffer you click on, in place of the buffer menu. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
95 \\[Buffer-menu-this-window] -- select current line's buffer in place of the buffer menu. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
96 \\[Buffer-menu-other-window] -- select that buffer in another window, |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
97 so the buffer menu buffer remains visible in its window. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
98 \\[Buffer-menu-switch-other-window] -- make another window display that buffer. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
99 \\[Buffer-menu-mark] -- mark current line's buffer to be displayed. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
100 \\[Buffer-menu-select] -- select current line's buffer. |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
101 Also show buffers marked with m, in other windows. |
777 | 102 \\[Buffer-menu-1-window] -- select that buffer in full-frame window. |
194 | 103 \\[Buffer-menu-2-window] -- select that buffer in one window, |
104 together with buffer selected before this one in another window. | |
105 \\[Buffer-menu-visit-tags-table] -- visit-tags-table this buffer. | |
106 \\[Buffer-menu-not-modified] -- clear modified-flag on that buffer. | |
107 \\[Buffer-menu-save] -- mark that buffer to be saved, and move down. | |
108 \\[Buffer-menu-delete] -- mark that buffer to be deleted, and move down. | |
109 \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted, and move up. | |
110 \\[Buffer-menu-execute] -- delete or save marked buffers. | |
111 \\[Buffer-menu-unmark] -- remove all kinds of marks from current line. | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
112 With prefix argument, also move up one line. |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
113 \\[Buffer-menu-backup-unmark] -- back up a line and remove marks. |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
114 \\[Buffer-menu-toggle-read-only] -- toggle read-only status of buffer on this line." |
194 | 115 (kill-all-local-variables) |
116 (use-local-map Buffer-menu-mode-map) | |
6638
61e40a447c92
(Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents:
6609
diff
changeset
|
117 (setq major-mode 'Buffer-menu-mode) |
61e40a447c92
(Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents:
6609
diff
changeset
|
118 (setq mode-name "Buffer Menu") |
61e40a447c92
(Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents:
6609
diff
changeset
|
119 (save-excursion |
61e40a447c92
(Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents:
6609
diff
changeset
|
120 (goto-char (point-min)) |
6640
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
121 (search-forward "Buffer") |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
122 (backward-word 1) |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
123 (setq Buffer-menu-buffer-column (current-column)) |
6638
61e40a447c92
(Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents:
6609
diff
changeset
|
124 (forward-line 2) |
61e40a447c92
(Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents:
6609
diff
changeset
|
125 (while (not (eobp)) |
6640
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
126 (let ((where (Buffer-menu-buffer-name-position))) |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
127 (put-text-property (car where) (cdr where) 'mouse-face 'highlight)) |
6638
61e40a447c92
(Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents:
6609
diff
changeset
|
128 (forward-line 1))) |
8161
6b104526819d
(Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7659
diff
changeset
|
129 (make-local-variable 'revert-buffer-function) |
6b104526819d
(Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7659
diff
changeset
|
130 (setq revert-buffer-function 'Buffer-menu-revert-function) |
194 | 131 (setq truncate-lines t) |
132 (setq buffer-read-only t) | |
133 (run-hooks 'buffer-menu-mode-hook)) | |
8161
6b104526819d
(Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7659
diff
changeset
|
134 |
6b104526819d
(Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7659
diff
changeset
|
135 (defun Buffer-menu-revert-function (ignore1 ignore2) |
6b104526819d
(Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7659
diff
changeset
|
136 (list-buffers)) |
194 | 137 |
138 (defun Buffer-menu-buffer (error-if-non-existent-p) | |
139 "Return buffer described by this line of buffer menu." | |
6640
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
140 (let* ((where (Buffer-menu-buffer-name-position)) |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
141 (string (buffer-substring (car where) (cdr where)))) |
10194
d59e8878ccca
(Buffer-menu-buffer): Clear text properties in STRING.
Richard M. Stallman <rms@gnu.org>
parents:
9063
diff
changeset
|
142 (set-text-properties 0 (length string) nil string) |
6640
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
143 (or (get-buffer string) |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
144 (if error-if-non-existent-p |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
145 (error "No buffer named \"%s\"" string) |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
146 nil)))) |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
147 |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
148 ;; Find the start and end positions of the buffer name on this line. |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
149 ;; Returns a cons (START . END). |
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
150 (defun Buffer-menu-buffer-name-position () |
194 | 151 (save-excursion |
152 (beginning-of-line) | |
153 (forward-char Buffer-menu-buffer-column) | |
6640
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
154 (let ((start (point))) |
194 | 155 (re-search-forward "\t\\| ") |
156 (skip-chars-backward " \t") | |
6640
532754d63384
(Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents:
6638
diff
changeset
|
157 (cons start (point))))) |
194 | 158 |
756 | 159 (defun buffer-menu (&optional arg) |
194 | 160 "Make a menu of buffers so you can save, delete or select them. |
161 With argument, show only buffers that are visiting files. | |
162 Type ? after invocation to get help on commands available. | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
163 Type q immediately to make the buffer menu go away and to restore |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
164 previous window configuration." |
194 | 165 (interactive "P") |
2736
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
166 ;;; (setq Buffer-menu-window-config (current-window-configuration)) |
8223
e82a71b09d7a
(buffer-menu): Call pop-to-buffer before
Richard M. Stallman <rms@gnu.org>
parents:
8196
diff
changeset
|
167 (list-buffers arg) |
8365
2d49d0dc9fc3
(buffer-menu): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8223
diff
changeset
|
168 (let ((newpoint (save-excursion (set-buffer "*Buffer List*") |
2d49d0dc9fc3
(buffer-menu): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8223
diff
changeset
|
169 (point)))) |
2d49d0dc9fc3
(buffer-menu): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8223
diff
changeset
|
170 (pop-to-buffer "*Buffer List*") |
2d49d0dc9fc3
(buffer-menu): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8223
diff
changeset
|
171 (goto-char newpoint)) |
194 | 172 (message |
2736
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
173 "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help.")) |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
174 |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
175 (defun Buffer-menu-quit () |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
176 "Quit the buffer menu." |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
177 (interactive) |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
178 (let ((buffer (current-buffer))) |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
179 ;; Restore previous window configuration before displaying |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
180 ;; selected buffers. |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
181 (switch-to-buffer (other-buffer)) |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
182 (bury-buffer buffer))) |
194 | 183 |
184 (defun Buffer-menu-mark () | |
185 "Mark buffer on this line for being displayed by \\<Buffer-menu-mode-map>\\[Buffer-menu-select] command." | |
186 (interactive) | |
187 (beginning-of-line) | |
188 (if (looking-at " [-M]") | |
189 (ding) | |
190 (let ((buffer-read-only nil)) | |
191 (delete-char 1) | |
192 (insert ?>) | |
193 (forward-line 1)))) | |
194 | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
195 (defun Buffer-menu-unmark (&optional backup) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
196 "Cancel all requested operations on buffer on this line and move down. |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
197 Optional ARG means move up." |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
198 (interactive "P") |
194 | 199 (beginning-of-line) |
200 (if (looking-at " [-M]") | |
201 (ding) | |
202 (let* ((buf (Buffer-menu-buffer t)) | |
203 (mod (buffer-modified-p buf)) | |
204 (readonly (save-excursion (set-buffer buf) buffer-read-only)) | |
205 (buffer-read-only nil)) | |
206 (delete-char 3) | |
207 (insert (if readonly (if mod " *%" " %") (if mod " * " " "))))) | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
208 (forward-line (if backup -1 1))) |
194 | 209 |
210 (defun Buffer-menu-backup-unmark () | |
211 "Move up and cancel all requested operations on buffer on line above." | |
212 (interactive) | |
213 (forward-line -1) | |
214 (Buffer-menu-unmark) | |
215 (forward-line -1)) | |
216 | |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
217 (defun Buffer-menu-delete (&optional arg) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
218 "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command. |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
219 Prefix arg is how many buffers to delete. |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
220 Negative arg means delete backwards." |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
221 (interactive "p") |
194 | 222 (beginning-of-line) |
223 (if (looking-at " [-M]") ;header lines | |
224 (ding) | |
225 (let ((buffer-read-only nil)) | |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
226 (if (or (null arg) (= arg 0)) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
227 (setq arg 1)) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
228 (while (> arg 0) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
229 (delete-char 1) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
230 (insert ?D) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
231 (forward-line 1) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
232 (setq arg (1- arg))) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
233 (while (< arg 0) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
234 (delete-char 1) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
235 (insert ?D) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
236 (forward-line -1) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
237 (setq arg (1+ arg)))))) |
194 | 238 |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
239 (defun Buffer-menu-delete-backwards (&optional arg) |
194 | 240 "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command |
9063
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
241 and then move up one line. Prefix arg means move that many lines." |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
242 (interactive "p") |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
243 (Buffer-menu-delete (- (or arg 1))) |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
244 (while (looking-at " [-M]") |
d6913bc11bb2
(Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
8365
diff
changeset
|
245 (forward-line 1))) |
194 | 246 |
247 (defun Buffer-menu-save () | |
248 "Mark buffer on this line to be saved by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command." | |
249 (interactive) | |
250 (beginning-of-line) | |
251 (forward-char 1) | |
252 (if (looking-at " [-M]") ;header lines | |
253 (ding) | |
254 (let ((buffer-read-only nil)) | |
255 (delete-char 1) | |
256 (insert ?S) | |
257 (forward-line 1)))) | |
258 | |
8196
89db3662bcec
(Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents:
8161
diff
changeset
|
259 (defun Buffer-menu-not-modified (&optional arg) |
194 | 260 "Mark buffer on this line as unmodified (no changes to save)." |
8196
89db3662bcec
(Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents:
8161
diff
changeset
|
261 (interactive "P") |
194 | 262 (save-excursion |
263 (set-buffer (Buffer-menu-buffer t)) | |
8196
89db3662bcec
(Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents:
8161
diff
changeset
|
264 (set-buffer-modified-p arg)) |
194 | 265 (save-excursion |
266 (beginning-of-line) | |
267 (forward-char 1) | |
8196
89db3662bcec
(Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents:
8161
diff
changeset
|
268 (if (= (char-after (point)) (if arg ? ?*)) |
194 | 269 (let ((buffer-read-only nil)) |
270 (delete-char 1) | |
8196
89db3662bcec
(Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents:
8161
diff
changeset
|
271 (insert (if arg ?* ? )))))) |
194 | 272 |
273 (defun Buffer-menu-execute () | |
274 "Save and/or delete buffers marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-save] or \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands." | |
275 (interactive) | |
276 (save-excursion | |
277 (goto-char (point-min)) | |
278 (forward-line 1) | |
279 (while (re-search-forward "^.S" nil t) | |
280 (let ((modp nil)) | |
281 (save-excursion | |
282 (set-buffer (Buffer-menu-buffer t)) | |
283 (save-buffer) | |
284 (setq modp (buffer-modified-p))) | |
285 (let ((buffer-read-only nil)) | |
286 (delete-char -1) | |
287 (insert (if modp ?* ? )))))) | |
288 (save-excursion | |
289 (goto-char (point-min)) | |
290 (forward-line 1) | |
291 (let ((buff-menu-buffer (current-buffer)) | |
292 (buffer-read-only nil)) | |
293 (while (search-forward "\nD" nil t) | |
294 (forward-char -1) | |
295 (let ((buf (Buffer-menu-buffer nil))) | |
296 (or (eq buf nil) | |
297 (eq buf buff-menu-buffer) | |
298 (save-excursion (kill-buffer buf)))) | |
299 (if (Buffer-menu-buffer nil) | |
300 (progn (delete-char 1) | |
301 (insert ? )) | |
302 (delete-region (point) (progn (forward-line 1) (point))) | |
303 (forward-char -1)))))) | |
304 | |
305 (defun Buffer-menu-select () | |
306 "Select this line's buffer; also display buffers marked with `>'. | |
307 You can mark buffers with the \\<Buffer-menu-mode-map>\\[Buffer-menu-mark] command." | |
308 (interactive) | |
309 (let ((buff (Buffer-menu-buffer t)) | |
310 (menu (current-buffer)) | |
311 (others ()) | |
312 tem) | |
313 (goto-char (point-min)) | |
314 (while (search-forward "\n>" nil t) | |
315 (setq tem (Buffer-menu-buffer t)) | |
316 (let ((buffer-read-only nil)) | |
317 (delete-char -1) | |
318 (insert ?\ )) | |
319 (or (eq tem buff) (memq tem others) (setq others (cons tem others)))) | |
320 (setq others (nreverse others) | |
777 | 321 tem (/ (1- (frame-height)) (1+ (length others)))) |
194 | 322 (delete-other-windows) |
323 (switch-to-buffer buff) | |
324 (or (eq menu buff) | |
325 (bury-buffer menu)) | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
326 (if (equal (length others) 0) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
327 (progn |
2736
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
328 ;;; ;; Restore previous window configuration before displaying |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
329 ;;; ;; selected buffers. |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
330 ;;; (if Buffer-menu-window-config |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
331 ;;; (progn |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
332 ;;; (set-window-configuration Buffer-menu-window-config) |
d6ff54640930
(buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents:
2422
diff
changeset
|
333 ;;; (setq Buffer-menu-window-config nil))) |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
334 (switch-to-buffer buff)) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
335 (while others |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
336 (split-window nil tem) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
337 (other-window 1) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
338 (switch-to-buffer (car others)) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
339 (setq others (cdr others))) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
340 (other-window 1) ;back to the beginning! |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
341 ))) |
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
342 |
194 | 343 |
344 (defun Buffer-menu-visit-tags-table () | |
345 "Visit the tags table in the buffer on this line. See `visit-tags-table'." | |
346 (interactive) | |
347 (let ((file (buffer-file-name (Buffer-menu-buffer t)))) | |
348 (if file | |
349 (visit-tags-table file) | |
350 (error "Specified buffer has no file")))) | |
351 | |
352 (defun Buffer-menu-1-window () | |
777 | 353 "Select this line's buffer, alone, in full frame." |
194 | 354 (interactive) |
355 (switch-to-buffer (Buffer-menu-buffer t)) | |
356 (bury-buffer (other-buffer)) | |
357 (delete-other-windows)) | |
358 | |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
359 (defun Buffer-menu-mouse-select (event) |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
360 "Select the buffer whose line you click on." |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
361 (interactive "e") |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
362 (let (buffer) |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
363 (save-excursion |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
364 (set-buffer (window-buffer (posn-window (event-end event)))) |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
365 (save-excursion |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
366 (goto-char (posn-point (event-end event))) |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
367 (setq buffer (Buffer-menu-buffer t)))) |
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
368 (select-window (posn-window (event-end event))) |
7659
ed3bbbdd9ef5
(Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents:
7298
diff
changeset
|
369 (if (and (window-dedicated-p (selected-window)) |
ed3bbbdd9ef5
(Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents:
7298
diff
changeset
|
370 (eq (selected-window) (frame-root-window))) |
ed3bbbdd9ef5
(Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents:
7298
diff
changeset
|
371 (switch-to-buffer-other-frame buffer) |
ed3bbbdd9ef5
(Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents:
7298
diff
changeset
|
372 (switch-to-buffer buffer)))) |
6609
3b1eb7f1eba1
(Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents:
6084
diff
changeset
|
373 |
194 | 374 (defun Buffer-menu-this-window () |
375 "Select this line's buffer in this window." | |
376 (interactive) | |
377 (switch-to-buffer (Buffer-menu-buffer t))) | |
378 | |
379 (defun Buffer-menu-other-window () | |
380 "Select this line's buffer in other window, leaving buffer menu visible." | |
381 (interactive) | |
382 (switch-to-buffer-other-window (Buffer-menu-buffer t))) | |
383 | |
735 | 384 (defun Buffer-menu-switch-other-window () |
385 "Make the other window select this line's buffer. | |
386 The current window remains selected." | |
387 (interactive) | |
388 (display-buffer (Buffer-menu-buffer t))) | |
389 | |
194 | 390 (defun Buffer-menu-2-window () |
391 "Select this line's buffer, with previous buffer in second window." | |
392 (interactive) | |
393 (let ((buff (Buffer-menu-buffer t)) | |
394 (menu (current-buffer)) | |
395 (pop-up-windows t)) | |
2334
ec4ffd67483d
Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
396 (delete-other-windows) |
194 | 397 (switch-to-buffer (other-buffer)) |
398 (pop-to-buffer buff) | |
399 (bury-buffer menu))) | |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
194
diff
changeset
|
400 |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
401 (defun Buffer-menu-toggle-read-only () |
6084
d42c85701055
(Buffer-menu-toggle-read-only): Change toggle-read-only to
Karl Heuer <kwzh@gnu.org>
parents:
3591
diff
changeset
|
402 "Toggle read-only status of buffer on this line, perhaps via version control." |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
403 (interactive) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
404 (let (char) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
405 (save-excursion |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
406 (set-buffer (Buffer-menu-buffer t)) |
6084
d42c85701055
(Buffer-menu-toggle-read-only): Change toggle-read-only to
Karl Heuer <kwzh@gnu.org>
parents:
3591
diff
changeset
|
407 (vc-toggle-read-only) |
2378
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
408 (setq char (if buffer-read-only ?% ? ))) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
409 (save-excursion |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
410 (beginning-of-line) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
411 (forward-char 2) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
412 (if (/= (following-char) char) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
413 (let (buffer-read-only) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
414 (delete-char 1) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
415 (insert char)))))) |
c5d0140aa7b6
(Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2334
diff
changeset
|
416 |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
194
diff
changeset
|
417 ;;; buff-menu.el ends here |