annotate lisp/buff-menu.el @ 39679:a6d0c76cc76c

(BASE_PURESIZE): Increase to 725000.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 08 Oct 2001 07:42:49 +0000
parents aa310bebddef
children 86b32dd85d89
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 38084
diff changeset
1 ;;; buff-menu.el --- buffer menu main function and support functions
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 194
diff changeset
2
39012
aa310bebddef Add Keywords header.
Gerd Moellmann <gerd@gnu.org>
parents: 38412
diff changeset
3 ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 2000, 2001
aa310bebddef Add Keywords header.
Gerd Moellmann <gerd@gnu.org>
parents: 38412
diff changeset
4 ;; Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 801
diff changeset
5
801
e9e34745ae3b *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
6 ;; Maintainer: FSF
39012
aa310bebddef Add Keywords header.
Gerd Moellmann <gerd@gnu.org>
parents: 38412
diff changeset
7 ;; Keywords: convenience
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
735
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 ;; any later version.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12243
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12243
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12243
diff changeset
24 ;; Boston, MA 02111-1307, USA.
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
26 ;;; Commentary:
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
27
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
28 ;; 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
29 ;; 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
30 ;; any special or scratch buffers you have loaded, since you can't find
39012
aa310bebddef Add Keywords header.
Gerd Moellmann <gerd@gnu.org>
parents: 38412
diff changeset
31 ;; them by filename. The single entry point is `list-buffers',
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
32 ;; 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
33
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 ;;; 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
35
25166
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
36 ;; Buffer-menu-view: New function
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
37 ;; Buffer-menu-view-other-window: New function
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
38
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
39 ;; 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
40 ;;
ec4ffd67483d Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
41 ;; 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
42 ;;
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 ;; 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
44 ;; 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
45 ;;
ec4ffd67483d Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
46 ;; 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
47
801
e9e34745ae3b *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
48 ;;; Code:
30851
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
49
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
50 ;;;Trying to preserve the old window configuration works well in
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
51 ;;;simple scenarios, when you enter the buffer menu, use it, and exit it.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
52 ;;;But it does strange things when you switch back to the buffer list buffer
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
53 ;;;with C-x b, later on, when the window configuration is different.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
54 ;;;The choice seems to be, either restore the window configuration
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
55 ;;;in all cases, or in no cases.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
56 ;;;I decided it was better not to restore the window config at all. -- rms.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
57
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
58 ;;;But since then, I changed buffer-menu to use the selected window,
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
59 ;;;so q now once again goes back to the previous window configuration.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
60
2736
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
61 ;;;(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
62 ;;; "Window configuration saved from entry to `buffer-menu'.")
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 ; Put buffer *Buffer List* into proper mode right away
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 ; so that from now on even list-buffers is enough to get a buffer menu.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66
6640
532754d63384 (Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents: 6638
diff changeset
67 (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
68
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 (defvar Buffer-menu-mode-map nil "")
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 (if Buffer-menu-mode-map
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 (setq Buffer-menu-mode-map (make-keymap))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 (suppress-keymap Buffer-menu-mode-map t)
21093
aa96b119d0ef (Buffer-menu-quit): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 20655
diff changeset
75 (define-key Buffer-menu-mode-map "q" 'quit-window)
2736
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
76 (define-key Buffer-menu-mode-map "v" 'Buffer-menu-select)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 (define-key Buffer-menu-mode-map "2" 'Buffer-menu-2-window)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (define-key Buffer-menu-mode-map "1" 'Buffer-menu-1-window)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 (define-key Buffer-menu-mode-map "f" 'Buffer-menu-this-window)
20655
a259327d5333 (Buffer-menu-mode-map): Bind e like f.
Richard M. Stallman <rms@gnu.org>
parents: 18280
diff changeset
80 (define-key Buffer-menu-mode-map "e" 'Buffer-menu-this-window)
10269
988517b0b62a (Buffer-menu-mode-map): Bind C-m to Buffer-menu-this-window.
Richard M. Stallman <rms@gnu.org>
parents: 10194
diff changeset
81 (define-key Buffer-menu-mode-map "\C-m" 'Buffer-menu-this-window)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (define-key Buffer-menu-mode-map "o" 'Buffer-menu-other-window)
735
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
83 (define-key Buffer-menu-mode-map "\C-o" 'Buffer-menu-switch-other-window)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (define-key Buffer-menu-mode-map "s" 'Buffer-menu-save)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (define-key Buffer-menu-mode-map "d" 'Buffer-menu-delete)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 (define-key Buffer-menu-mode-map "k" 'Buffer-menu-delete)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (define-key Buffer-menu-mode-map "\C-d" 'Buffer-menu-delete-backwards)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (define-key Buffer-menu-mode-map "\C-k" 'Buffer-menu-delete)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (define-key Buffer-menu-mode-map "x" 'Buffer-menu-execute)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (define-key Buffer-menu-mode-map " " 'next-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (define-key Buffer-menu-mode-map "n" 'next-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (define-key Buffer-menu-mode-map "p" 'previous-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 (define-key Buffer-menu-mode-map "\177" 'Buffer-menu-backup-unmark)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 (define-key Buffer-menu-mode-map "~" 'Buffer-menu-not-modified)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 (define-key Buffer-menu-mode-map "?" 'describe-mode)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 (define-key Buffer-menu-mode-map "u" 'Buffer-menu-unmark)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (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
98 (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
99 (define-key Buffer-menu-mode-map "%" 'Buffer-menu-toggle-read-only)
18278
4f78346eb734 (Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents: 16401
diff changeset
100 (define-key Buffer-menu-mode-map "b" 'Buffer-menu-bury)
16401
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
101 (define-key Buffer-menu-mode-map "g" 'Buffer-menu-revert)
25166
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
102 (define-key Buffer-menu-mode-map "V" 'Buffer-menu-view)
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
103 (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
104 )
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 ;; Buffer Menu mode is suitable only for specially formatted data.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 (put 'Buffer-menu-mode 'mode-class 'special)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 (defun Buffer-menu-mode ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 "Major mode for editing a list of buffers.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 Each line describes one of the buffers in Emacs.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 Letters do not insert themselves; instead, they are commands.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 \\<Buffer-menu-mode-map>
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
114 \\[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
115 \\[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
116 \\[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
117 so the buffer menu buffer remains visible in its window.
25166
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
118 \\[Buffer-menu-view] -- select current line's buffer, but in view-mode.
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
119 \\[Buffer-menu-view-other-window] -- select that buffer in
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
120 another window, in view-mode.
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
121 \\[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
122 \\[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
123 \\[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
124 Also show buffers marked with m, in other windows.
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
125 \\[Buffer-menu-1-window] -- select that buffer in full-frame window.
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 \\[Buffer-menu-2-window] -- select that buffer in one window,
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 together with buffer selected before this one in another window.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 \\[Buffer-menu-visit-tags-table] -- visit-tags-table this buffer.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 \\[Buffer-menu-not-modified] -- clear modified-flag on that buffer.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 \\[Buffer-menu-save] -- mark that buffer to be saved, and move down.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 \\[Buffer-menu-delete] -- mark that buffer to be deleted, and move down.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted, and move up.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 \\[Buffer-menu-execute] -- delete or save marked buffers.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 \\[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
135 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
136 \\[Buffer-menu-backup-unmark] -- back up a line and remove marks.
16401
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
137 \\[Buffer-menu-toggle-read-only] -- toggle read-only status of buffer on this line.
18280
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
138 \\[Buffer-menu-revert] -- update the list of buffers.
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
139 \\[Buffer-menu-bury] -- bury the buffer listed on this line."
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 (kill-all-local-variables)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 (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
142 (setq major-mode 'Buffer-menu-mode)
61e40a447c92 (Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents: 6609
diff changeset
143 (setq mode-name "Buffer Menu")
8161
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
144 (make-local-variable 'revert-buffer-function)
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
145 (setq revert-buffer-function 'Buffer-menu-revert-function)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 (setq truncate-lines t)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (setq buffer-read-only t)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 (run-hooks 'buffer-menu-mode-hook))
8161
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
149
16401
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
150 (defun Buffer-menu-revert ()
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
151 "Update the list of buffers."
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
152 (interactive)
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
153 (revert-buffer))
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
154
8161
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
155 (defun Buffer-menu-revert-function (ignore1 ignore2)
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
156 (list-buffers))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 (defun Buffer-menu-buffer (error-if-non-existent-p)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 "Return buffer described by this line of buffer menu."
11215
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
160 (let* ((where (save-excursion
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
161 (beginning-of-line)
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
162 (+ (point) Buffer-menu-buffer-column)))
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
163 (name (and (not (eobp)) (get-text-property where 'buffer-name)))
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
164 (buf (and (not (eobp)) (get-text-property where 'buffer))))
11215
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
165 (if name
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
166 (or (get-buffer name)
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
167 (and buf (buffer-name buf) buf)
11215
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
168 (if error-if-non-existent-p
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
169 (error "No buffer named `%s'" name)
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
170 nil))
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
171 (or (and buf (buffer-name buf) buf)
11215
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
172 (if error-if-non-existent-p
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
173 (error "No buffer on this line")
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
174 nil)))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
176 (defun buffer-menu (&optional arg)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 "Make a menu of buffers so you can save, delete or select them.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 With argument, show only buffers that are visiting files.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 Type ? after invocation to get help on commands available.
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
180 Type q immediately to make the buffer menu go away."
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 (interactive "P")
2736
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
182 ;;; (setq Buffer-menu-window-config (current-window-configuration))
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
183 (switch-to-buffer (list-buffers-noselect arg))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
184 (message
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
185 "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help."))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
186
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
187 (defun buffer-menu-other-window (&optional arg)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
188 "Display a list of buffers in another window.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
189 With the buffer list buffer, you can save, delete or select the buffers.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
190 With argument, show only buffers that are visiting files.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
191 Type ? after invocation to get help on commands available.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
192 Type q immediately to make the buffer menu go away."
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
193 (interactive "P")
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
194 ;;; (setq Buffer-menu-window-config (current-window-configuration))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
195 (switch-to-buffer-other-window (list-buffers-noselect arg))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 (message
2736
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
197 "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
198
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (defun Buffer-menu-mark ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 "Mark buffer on this line for being displayed by \\<Buffer-menu-mode-map>\\[Buffer-menu-select] command."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (beginning-of-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 (if (looking-at " [-M]")
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 (ding)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 (let ((buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 (delete-char 1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 (insert ?>)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (forward-line 1))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209
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
210 (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
211 "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
212 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
213 (interactive "P")
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 (beginning-of-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 (if (looking-at " [-M]")
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 (ding)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (let* ((buf (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 (mod (buffer-modified-p buf))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 (readonly (save-excursion (set-buffer buf) buffer-read-only))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 (buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 (delete-char 3)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 (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
223 (forward-line (if backup -1 1)))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 (defun Buffer-menu-backup-unmark ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 "Move up and cancel all requested operations on buffer on line above."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 (forward-line -1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 (Buffer-menu-unmark)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 (forward-line -1))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231
9063
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
232 (defun Buffer-menu-delete (&optional arg)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
233 "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
234 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
235 Negative arg means delete backwards."
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
236 (interactive "p")
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 (beginning-of-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 (if (looking-at " [-M]") ;header lines
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 (ding)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 (let ((buffer-read-only nil))
9063
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
241 (if (or (null arg) (= arg 0))
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
242 (setq arg 1))
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
243 (while (> arg 0)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
244 (delete-char 1)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
245 (insert ?D)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
246 (forward-line 1)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
247 (setq arg (1- arg)))
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
248 (while (< arg 0)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
249 (delete-char 1)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
250 (insert ?D)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
251 (forward-line -1)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
252 (setq arg (1+ arg))))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253
9063
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
254 (defun Buffer-menu-delete-backwards (&optional arg)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 "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
256 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
257 (interactive "p")
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
258 (Buffer-menu-delete (- (or arg 1)))
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
259 (while (looking-at " [-M]")
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
260 (forward-line 1)))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 (defun Buffer-menu-save ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 "Mark buffer on this line to be saved by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 (beginning-of-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (if (looking-at " [-M]") ;header lines
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (ding)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 (let ((buffer-read-only nil))
10765
638d2df80894 (Buffer-menu-save): Fix the test for header line.
Richard M. Stallman <rms@gnu.org>
parents: 10593
diff changeset
269 (forward-char 1)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 (delete-char 1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 (insert ?S)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 (forward-line 1))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273
8196
89db3662bcec (Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents: 8161
diff changeset
274 (defun Buffer-menu-not-modified (&optional arg)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 "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
276 (interactive "P")
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 (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
279 (set-buffer-modified-p arg))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 (beginning-of-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 (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
283 (if (= (char-after (point)) (if arg ? ?*))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 (let ((buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 (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
286 (insert (if arg ?* ? ))))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 (defun Buffer-menu-execute ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 "Save and/or delete buffers marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-save] or \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 (goto-char (point-min))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 (forward-line 1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 (while (re-search-forward "^.S" nil t)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 (let ((modp nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 (set-buffer (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 (save-buffer)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 (setq modp (buffer-modified-p)))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 (let ((buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 (delete-char -1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 (insert (if modp ?* ? ))))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 (goto-char (point-min))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 (forward-line 1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 (let ((buff-menu-buffer (current-buffer))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 (buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 (while (search-forward "\nD" nil t)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 (forward-char -1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 (let ((buf (Buffer-menu-buffer nil)))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 (or (eq buf nil)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 (eq buf buff-menu-buffer)
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
313 (save-excursion (kill-buffer buf)))
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
314 (if (and buf (buffer-name buf))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 (progn (delete-char 1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 (insert ? ))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 (delete-region (point) (progn (forward-line 1) (point)))
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
318 (forward-char -1)))))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 (defun Buffer-menu-select ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 "Select this line's buffer; also display buffers marked with `>'.
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
322 You can mark buffers with the \\<Buffer-menu-mode-map>\\[Buffer-menu-mark] command.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
323 This command deletes and replaces all the previously existing windows
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
324 in the selected frame."
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 (let ((buff (Buffer-menu-buffer t))
30851
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
327 (menu (current-buffer))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 (others ())
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 tem)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 (goto-char (point-min))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 (while (search-forward "\n>" nil t)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 (setq tem (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 (let ((buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 (delete-char -1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 (insert ?\ ))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 (or (eq tem buff) (memq tem others) (setq others (cons tem others))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 (setq others (nreverse others)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
338 tem (/ (1- (frame-height)) (1+ (length others))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 (delete-other-windows)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 (switch-to-buffer buff)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 (or (eq menu buff)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 (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
343 (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
344 (progn
2736
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
345 ;;; ;; 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
346 ;;; ;; selected buffers.
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
347 ;;; (if Buffer-menu-window-config
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
348 ;;; (progn
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
349 ;;; (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
350 ;;; (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
351 (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
352 (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
353 (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
354 (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
355 (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
356 (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
357 (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
358 )))
ec4ffd67483d Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
359
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
360
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 (defun Buffer-menu-visit-tags-table ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 "Visit the tags table in the buffer on this line. See `visit-tags-table'."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 (let ((file (buffer-file-name (Buffer-menu-buffer t))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 (if file
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 (visit-tags-table file)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 (error "Specified buffer has no file"))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (defun Buffer-menu-1-window ()
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
371 "Select this line's buffer, alone, in full frame."
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 (switch-to-buffer (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 (bury-buffer (other-buffer))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 (delete-other-windows))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
377 (defun Buffer-menu-mouse-select (event)
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
378 "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
379 (interactive "e")
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
380 (let (buffer)
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
381 (save-excursion
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
382 (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
383 (save-excursion
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
384 (goto-char (posn-point (event-end event)))
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
385 (setq buffer (Buffer-menu-buffer t))))
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
386 (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
387 (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
388 (eq (selected-window) (frame-root-window)))
ed3bbbdd9ef5 (Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
389 (switch-to-buffer-other-frame buffer)
ed3bbbdd9ef5 (Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
390 (switch-to-buffer buffer))))
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
391
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392 (defun Buffer-menu-this-window ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 "Select this line's buffer in this window."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 (switch-to-buffer (Buffer-menu-buffer t)))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 (defun Buffer-menu-other-window ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 "Select this line's buffer in other window, leaving buffer menu visible."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400 (switch-to-buffer-other-window (Buffer-menu-buffer t)))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401
735
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
402 (defun Buffer-menu-switch-other-window ()
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
403 "Make the other window select this line's buffer.
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
404 The current window remains selected."
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
405 (interactive)
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
406 (display-buffer (Buffer-menu-buffer t)))
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
407
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 (defun Buffer-menu-2-window ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 "Select this line's buffer, with previous buffer in second window."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 (let ((buff (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 (menu (current-buffer))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 (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
414 (delete-other-windows)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 (switch-to-buffer (other-buffer))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 (pop-to-buffer buff)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417 (bury-buffer menu)))
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 194
diff changeset
418
2378
c5d0140aa7b6 (Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2334
diff changeset
419 (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
420 "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
421 (interactive)
c5d0140aa7b6 (Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2334
diff changeset
422 (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
423 (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
424 (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
425 (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
426 (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
427 (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
428 (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
429 (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
430 (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
431 (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
432 (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
433 (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
434
18278
4f78346eb734 (Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents: 16401
diff changeset
435 (defun Buffer-menu-bury ()
4f78346eb734 (Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents: 16401
diff changeset
436 "Bury the buffer listed on this line."
4f78346eb734 (Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents: 16401
diff changeset
437 (interactive)
18280
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
438 (beginning-of-line)
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
439 (if (looking-at " [-M]") ;header lines
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
440 (ding)
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
441 (save-excursion
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
442 (beginning-of-line)
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
443 (bury-buffer (Buffer-menu-buffer t))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
444 (let ((line (buffer-substring (point) (progn (forward-line 1) (point))))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
445 (buffer-read-only nil))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
446 (delete-region (point) (progn (forward-line -1) (point)))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
447 (goto-char (point-max))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
448 (insert line))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
449 (message "Buried buffer moved to the end"))))
25166
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
450
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
451
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
452 (defun Buffer-menu-view ()
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
453 "View this line's buffer in View mode."
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
454 (interactive)
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
455 (view-buffer (Buffer-menu-buffer t)))
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
456
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
457
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
458 (defun Buffer-menu-view-other-window ()
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
459 "View this line's buffer in View mode in another window."
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
460 (interactive)
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
461 (view-buffer-other-window (Buffer-menu-buffer t)))
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
462
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
463
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
464 (define-key ctl-x-map "\C-b" 'list-buffers)
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
465
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
466 (defun list-buffers (&optional files-only)
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
467 "Display a list of names of existing buffers.
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
468 The list is displayed in a buffer named `*Buffer List*'.
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
469 Note that buffers with names starting with spaces are omitted.
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
470 Non-null optional arg FILES-ONLY means mention only file buffers.
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
471
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
472 The M column contains a * for buffers that are modified.
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
473 The R column contains a % for buffers that are read-only."
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
474 (interactive "P")
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
475 (display-buffer (list-buffers-noselect files-only)))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
476
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
477 (defun list-buffers-noselect (&optional files-only)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
478 "Create and return a buffer with a list of names of existing buffers.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
479 The buffer is named `*Buffer List*'.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
480 Note that buffers with names starting with spaces are omitted.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
481 Non-null optional arg FILES-ONLY means mention only file buffers.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
482
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
483 The M column contains a * for buffers that are modified.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
484 The R column contains a % for buffers that are read-only."
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
485 (let ((old-buffer (current-buffer))
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
486 (standard-output standard-output)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
487 desired-point)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
488 (save-excursion
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
489 (set-buffer (get-buffer-create "*Buffer List*"))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
490 (setq buffer-read-only nil)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
491 (erase-buffer)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
492 (setq standard-output (current-buffer))
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
493 (princ "\
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
494 MR Buffer Size Mode File
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
495 -- ------ ---- ---- ----
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
496 ")
11215
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
497 ;; Record the column where buffer names start.
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
498 (setq Buffer-menu-buffer-column 4)
30851
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
499 (dolist (buffer (buffer-list))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
500 (let ((name (buffer-name buffer))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
501 (file (buffer-file-name buffer))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
502 this-buffer-line-start
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
503 this-buffer-read-only
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
504 (this-buffer-size (buffer-size buffer))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
505 this-buffer-mode-name
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
506 this-buffer-directory)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
507 (with-current-buffer buffer
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
508 (setq this-buffer-read-only buffer-read-only
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
509 this-buffer-mode-name mode-name)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
510 (unless file
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
511 ;; No visited file. Check local value of
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
512 ;; list-buffers-directory.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
513 (when (and (boundp 'list-buffers-directory)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
514 list-buffers-directory)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
515 (setq this-buffer-directory list-buffers-directory))))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
516 (cond
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
517 ;; Don't mention internal buffers.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
518 ((string= (substring name 0 1) " "))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
519 ;; Maybe don't mention buffers without files.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
520 ((and files-only (not file)))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
521 ((string= name "*Buffer List*"))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
522 ;; Otherwise output info.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
523 (t
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
524 (setq this-buffer-line-start (point))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
525 ;; Identify current buffer.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
526 (if (eq buffer old-buffer)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
527 (progn
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
528 (setq desired-point (point))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
529 (princ "."))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
530 (princ " "))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
531 ;; Identify modified buffers.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
532 (princ (if (buffer-modified-p buffer) "*" " "))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
533 ;; Handle readonly status. The output buffer is special
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
534 ;; cased to appear readonly; it is actually made so at a
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
535 ;; later date.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
536 (princ (if (or (eq buffer standard-output)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
537 this-buffer-read-only)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
538 "% "
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
539 " "))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
540 (princ name)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
541 ;; Put the buffer name into a text property
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
542 ;; so we don't have to extract it from the text.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
543 ;; This way we avoid problems with unusual buffer names.
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
544 (setq this-buffer-line-start
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
545 (+ this-buffer-line-start Buffer-menu-buffer-column))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
546 (let ((name-end (point)))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
547 (indent-to 17 2)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
548 (put-text-property this-buffer-line-start name-end
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
549 'buffer-name name)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
550 (put-text-property this-buffer-line-start (point)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
551 'buffer buffer)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
552 (put-text-property this-buffer-line-start name-end
38084
4f75256c6aae (list-buffers-noselect): Add help-echo to mouse-highlighted text.
Eli Zaretskii <eliz@gnu.org>
parents: 31558
diff changeset
553 'mouse-face 'highlight)
4f75256c6aae (list-buffers-noselect): Add help-echo to mouse-highlighted text.
Eli Zaretskii <eliz@gnu.org>
parents: 31558
diff changeset
554 (put-text-property this-buffer-line-start name-end
4f75256c6aae (list-buffers-noselect): Add help-echo to mouse-highlighted text.
Eli Zaretskii <eliz@gnu.org>
parents: 31558
diff changeset
555 'help-echo "mouse-2: select this buffer"))
30851
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
556 (let ((size (format "%8d" this-buffer-size))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
557 (mode this-buffer-mode-name)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
558 (excess (- (current-column) 17)))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
559 (while (and (> excess 0) (= (aref size 0) ?\ ))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
560 (setq size (substring size 1)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
561 excess (1- excess)))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
562 (princ size)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
563 (indent-to 27 1)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
564 (princ mode))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
565 (indent-to 40 1)
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
566 (or file (setq file this-buffer-directory))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
567 (when file
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
568 (princ (abbreviate-file-name file)))
f9233f642b88 * buff-menu.el (list-buffers-noselect): Use `dolist' instead of
Sam Steingold <sds@gnu.org>
parents: 30828
diff changeset
569 (princ "\n")))))
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
570 (Buffer-menu-mode)
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
571 ;; DESIRED-POINT doesn't have to be set; it is not when the
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
572 ;; current buffer is not displayed for some reason.
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
573 (and desired-point
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
574 (goto-char desired-point))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
575 (current-buffer))))
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
576
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 194
diff changeset
577 ;;; buff-menu.el ends here