annotate lisp/buff-menu.el @ 49176:56966d83f3a5

(sh-mode-map): Use command remapping instead of substitute-key-definition.
author Andreas Schwab <schwab@suse.de>
date Sun, 12 Jan 2003 20:51:12 +0000
parents e8a430c172dc
children cd78fe221607 d7ddb3e565de
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
49046
d6e1c5f7f468 (Buffer-menu-buffer+size): Don't clobber buffer name.
Andreas Schwab <schwab@suse.de>
parents: 48889
diff changeset
3 ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 2000, 2001, 2002, 2003
39012
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
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
67 (defgroup Buffer-menu nil
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
68 "Show a menu of all buffers in a buffer."
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
69 :group 'tools
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
70 :group 'convenience)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
71
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
72 (defcustom Buffer-menu-use-header-line t
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
73 "*Non-nil means to use an immovable header-line."
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
74 :type 'boolean
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
75 :group 'Buffer-menu)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
76
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
77 (defface Buffer-menu-buffer-face
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
78 '((t (:weight bold)))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
79 "Face used to highlight buffer name."
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
80 :group 'font-lock-highlighting-faces)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
81
48889
ec1a96fb72d6 Change default width of Buffer-menu-buffer+size-width to 24
Robert J. Chassell <bob@rattlesnake.com>
parents: 48864
diff changeset
82 (defcustom Buffer-menu-buffer+size-width 26
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
83 "*How wide to jointly make the buffer name and size columns."
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
84 :type 'number
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
85 :group 'Buffer-menu)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
86
48889
ec1a96fb72d6 Change default width of Buffer-menu-buffer+size-width to 24
Robert J. Chassell <bob@rattlesnake.com>
parents: 48864
diff changeset
87 (defcustom Buffer-menu-mode-width 16
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
88 "*How wide to make the mode name column."
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
89 :type 'number
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
90 :group 'Buffer-menu)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
91
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
92 ; This should get updated & resorted when you click on a column heading
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
93 (defvar Buffer-menu-sort-column nil
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
94 "*2 for sorting by buffer names. 5 for sorting by file names.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
95 nil for default sorting by visited order.")
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
96
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
97 (defconst Buffer-menu-buffer-column 4)
6640
532754d63384 (Buffer-menu-mode): Highlight only the buffer name, not the whole line.
Karl Heuer <kwzh@gnu.org>
parents: 6638
diff changeset
98
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 (defvar Buffer-menu-mode-map nil "")
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 (if Buffer-menu-mode-map
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 (setq Buffer-menu-mode-map (make-keymap))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 (suppress-keymap Buffer-menu-mode-map t)
21093
aa96b119d0ef (Buffer-menu-quit): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 20655
diff changeset
105 (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
106 (define-key Buffer-menu-mode-map "v" 'Buffer-menu-select)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 (define-key Buffer-menu-mode-map "2" 'Buffer-menu-2-window)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 (define-key Buffer-menu-mode-map "1" 'Buffer-menu-1-window)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 (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
110 (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
111 (define-key Buffer-menu-mode-map "\C-m" 'Buffer-menu-this-window)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 (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
113 (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
114 (define-key Buffer-menu-mode-map "s" 'Buffer-menu-save)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 (define-key Buffer-menu-mode-map "d" 'Buffer-menu-delete)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (define-key Buffer-menu-mode-map "k" 'Buffer-menu-delete)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 (define-key Buffer-menu-mode-map "\C-d" 'Buffer-menu-delete-backwards)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 (define-key Buffer-menu-mode-map "\C-k" 'Buffer-menu-delete)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 (define-key Buffer-menu-mode-map "x" 'Buffer-menu-execute)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 (define-key Buffer-menu-mode-map " " 'next-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (define-key Buffer-menu-mode-map "n" 'next-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 (define-key Buffer-menu-mode-map "p" 'previous-line)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 (define-key Buffer-menu-mode-map "\177" 'Buffer-menu-backup-unmark)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 (define-key Buffer-menu-mode-map "~" 'Buffer-menu-not-modified)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 (define-key Buffer-menu-mode-map "?" 'describe-mode)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (define-key Buffer-menu-mode-map "u" 'Buffer-menu-unmark)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (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
128 (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
129 (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
130 (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
131 (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
132 (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
133 (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
134 )
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 ;; Buffer Menu mode is suitable only for specially formatted data.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 (put 'Buffer-menu-mode 'mode-class 'special)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 (defun Buffer-menu-mode ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 "Major mode for editing a list of buffers.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 Each line describes one of the buffers in Emacs.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 Letters do not insert themselves; instead, they are commands.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 \\<Buffer-menu-mode-map>
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
144 \\[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
145 \\[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
146 \\[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
147 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
148 \\[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
149 \\[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
150 another window, in view-mode.
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
151 \\[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
152 \\[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
153 \\[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
154 Also show buffers marked with m, in other windows.
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
155 \\[Buffer-menu-1-window] -- select that buffer in full-frame window.
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 \\[Buffer-menu-2-window] -- select that buffer in one window,
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 together with buffer selected before this one in another window.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 \\[Buffer-menu-visit-tags-table] -- visit-tags-table this buffer.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 \\[Buffer-menu-not-modified] -- clear modified-flag on that buffer.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 \\[Buffer-menu-save] -- mark that buffer to be saved, and move down.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 \\[Buffer-menu-delete] -- mark that buffer to be deleted, and move down.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted, and move up.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 \\[Buffer-menu-execute] -- delete or save marked buffers.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 \\[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
165 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
166 \\[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
167 \\[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
168 \\[Buffer-menu-revert] -- update the list of buffers.
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
169 \\[Buffer-menu-bury] -- bury the buffer listed on this line."
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 (kill-all-local-variables)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 (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
172 (setq major-mode 'Buffer-menu-mode)
61e40a447c92 (Buffer-menu-mode): Add mouse-face properties.
Karl Heuer <kwzh@gnu.org>
parents: 6609
diff changeset
173 (setq mode-name "Buffer Menu")
8161
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
174 (make-local-variable 'revert-buffer-function)
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
175 (setq revert-buffer-function 'Buffer-menu-revert-function)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 (setq truncate-lines t)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 (setq buffer-read-only t)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 (run-hooks 'buffer-menu-mode-hook))
8161
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
179
16401
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
180 (defun Buffer-menu-revert ()
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
181 "Update the list of buffers."
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
182 (interactive)
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
183 (revert-buffer))
249f797c3750 (Buffer-menu-revert): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
184
8161
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
185 (defun Buffer-menu-revert-function (ignore1 ignore2)
6b104526819d (Buffer-menu-revert-function): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7659
diff changeset
186 (list-buffers))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 (defun Buffer-menu-buffer (error-if-non-existent-p)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 "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
190 (let* ((where (save-excursion
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
191 (beginning-of-line)
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
192 (+ (point) Buffer-menu-buffer-column)))
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
193 (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
194 (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
195 (if name
896932ac8ced (list-buffers-noselect): Put buffer name in a text
Richard M. Stallman <rms@gnu.org>
parents: 10765
diff changeset
196 (or (get-buffer name)
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
197 (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
198 (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
199 (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
200 nil))
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
201 (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
202 (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
203 (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
204 nil)))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 735
diff changeset
206 (defun buffer-menu (&optional arg)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 "Make a menu of buffers so you can save, delete or select them.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 With argument, show only buffers that are visiting files.
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 Type ? after invocation to get help on commands available.
40622
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
210 Type q to remove the buffer menu from the display.
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
211
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
212 The first column shows `>' for a buffer you have
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
213 marked to be displayed, `D' for one you have marked for
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
214 deletion, and `.' for the current buffer.
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
215
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
216 The C column has a `.' for the buffer from which you came.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
217 The R column has a `%' if the buffer is read-only.
40622
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
218 The M column has a `*' if it is modified,
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
219 or `S' if you have marked it for saving.
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
220 After this come the buffer name, its size in characters,
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
221 its major mode, and the visited file name (if any)."
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 (interactive "P")
2736
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
223 ;;; (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
224 (switch-to-buffer (list-buffers-noselect arg))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
225 (message
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
226 "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
227
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
228 (defun buffer-menu-other-window (&optional arg)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
229 "Display a list of buffers in another window.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
230 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
231 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
232 Type ? after invocation to get help on commands available.
40622
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
233 Type q to remove the buffer menu from the display.
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
234 For more information, see the function `buffer-menu'."
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
235 (interactive "P")
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
236 ;;; (setq Buffer-menu-window-config (current-window-configuration))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
237 (switch-to-buffer-other-window (list-buffers-noselect arg))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 (message
2736
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
239 "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
240
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
241 (defun Buffer-menu-no-header ()
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
242 (beginning-of-line)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
243 (if (or Buffer-menu-use-header-line
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
244 (not (eq (char-after) ?C)))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
245 t
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
246 (ding)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
247 (forward-line 1)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
248 nil))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
249
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 (defun Buffer-menu-mark ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 "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
252 (interactive)
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
253 (when (Buffer-menu-no-header)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 (let ((buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 (delete-char 1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (insert ?>)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 (forward-line 1))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258
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
259 (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
260 "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
261 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
262 (interactive "P")
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
263 (when (Buffer-menu-no-header)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (let* ((buf (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 (mod (buffer-modified-p buf))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (readonly (save-excursion (set-buffer buf) buffer-read-only))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 (delete-char 3)
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
269 (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
270 (forward-line (if backup -1 1)))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 (defun Buffer-menu-backup-unmark ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 "Move up and cancel all requested operations on buffer on line above."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 (forward-line -1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 (Buffer-menu-unmark)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 (forward-line -1))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278
9063
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
279 (defun Buffer-menu-delete (&optional arg)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
280 "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
281 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
282 Negative arg means delete backwards."
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
283 (interactive "p")
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
284 (when (Buffer-menu-no-header)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 (let ((buffer-read-only nil))
9063
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
286 (if (or (null arg) (= arg 0))
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
287 (setq arg 1))
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
288 (while (> arg 0)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
289 (delete-char 1)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
290 (insert ?D)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
291 (forward-line 1)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
292 (setq arg (1- arg)))
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
293 (while (and (< arg 0)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
294 (Buffer-menu-no-header))
9063
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
295 (delete-char 1)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
296 (insert ?D)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
297 (forward-line -1)
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
298 (setq arg (1+ arg))))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299
9063
d6913bc11bb2 (Buffer-menu-delete): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 8365
diff changeset
300 (defun Buffer-menu-delete-backwards (&optional arg)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 "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
302 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
303 (interactive "p")
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
304 (Buffer-menu-delete (- (or arg 1))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 (defun Buffer-menu-save ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 "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
308 (interactive)
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
309 (when (Buffer-menu-no-header)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 (let ((buffer-read-only nil))
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
311 (forward-char 2)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 (delete-char 1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 (insert ?S)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 (forward-line 1))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315
8196
89db3662bcec (Buffer-menu-not-modified): Make `Buffer-menu-not-modified' handle an
Richard M. Stallman <rms@gnu.org>
parents: 8161
diff changeset
316 (defun Buffer-menu-not-modified (&optional arg)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 "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
318 (interactive "P")
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 (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
321 (set-buffer-modified-p arg))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 (beginning-of-line)
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
324 (forward-char 2)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
325 (if (= (char-after) (if arg ? ?*))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 (let ((buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 (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
328 (insert (if arg ?* ? ))))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 (defun Buffer-menu-execute ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 "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
332 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 (goto-char (point-min))
49050
8b38bac9826a (Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents: 49046
diff changeset
335 (unless Buffer-menu-use-header-line
8b38bac9826a (Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents: 49046
diff changeset
336 (forward-line 1))
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
337 (while (re-search-forward "^..S" nil t)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 (let ((modp nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 (set-buffer (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 (save-buffer)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 (setq modp (buffer-modified-p)))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 (let ((buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 (delete-char -1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 (insert (if modp ?* ? ))))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 (save-excursion
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 (goto-char (point-min))
49050
8b38bac9826a (Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents: 49046
diff changeset
348 (unless Buffer-menu-use-header-line
8b38bac9826a (Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents: 49046
diff changeset
349 (forward-line 1))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 (let ((buff-menu-buffer (current-buffer))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 (buffer-read-only nil))
49050
8b38bac9826a (Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents: 49046
diff changeset
352 (while (re-search-forward "^D" nil t)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 (forward-char -1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 (let ((buf (Buffer-menu-buffer nil)))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 (or (eq buf nil)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 (eq buf buff-menu-buffer)
30828
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
357 (save-excursion (kill-buffer buf)))
26dae0a7f527 (list-buffers-noselect): Set `buffer' as well as
Gerd Moellmann <gerd@gnu.org>
parents: 30824
diff changeset
358 (if (and buf (buffer-name buf))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 (progn (delete-char 1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 (insert ? ))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 (delete-region (point) (progn (forward-line 1) (point)))
49050
8b38bac9826a (Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents: 49046
diff changeset
362 (unless (bobp)
8b38bac9826a (Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents: 49046
diff changeset
363 (forward-char -1))))))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 (defun Buffer-menu-select ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 "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
367 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
368 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
369 in the selected frame."
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 (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
372 (menu (current-buffer))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 (others ())
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 tem)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 (goto-char (point-min))
49155
e8a430c172dc (Buffer-menu-select): Fix for effect of header line.
Andreas Schwab <schwab@suse.de>
parents: 49050
diff changeset
376 (unless Buffer-menu-use-header-line
e8a430c172dc (Buffer-menu-select): Fix for effect of header line.
Andreas Schwab <schwab@suse.de>
parents: 49050
diff changeset
377 (forward-line 1))
e8a430c172dc (Buffer-menu-select): Fix for effect of header line.
Andreas Schwab <schwab@suse.de>
parents: 49050
diff changeset
378 (while (re-search-forward "^>" nil t)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 (setq tem (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 (let ((buffer-read-only nil))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 (delete-char -1)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 (insert ?\ ))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 (or (eq tem buff) (memq tem others) (setq others (cons tem others))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 (setq others (nreverse others)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
385 tem (/ (1- (frame-height)) (1+ (length others))))
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 (delete-other-windows)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 (switch-to-buffer buff)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388 (or (eq menu buff)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 (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
390 (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
391 (progn
2736
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
392 ;;; ;; 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
393 ;;; ;; selected buffers.
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
394 ;;; (if Buffer-menu-window-config
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
395 ;;; (progn
d6ff54640930 (buffer-menu): Don't save a window config.
Richard M. Stallman <rms@gnu.org>
parents: 2422
diff changeset
396 ;;; (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
397 ;;; (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
398 (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
399 (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
400 (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
401 (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
402 (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
403 (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
404 (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
405 )))
ec4ffd67483d Incorporated changes from Bob Weiner's enhanced buff-menu from the LCD
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2307
diff changeset
406
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
407
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 (defun Buffer-menu-visit-tags-table ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 "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
411 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 (let ((file (buffer-file-name (Buffer-menu-buffer t))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 (if file
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 (visit-tags-table file)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 (error "Specified buffer has no file"))))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417 (defun Buffer-menu-1-window ()
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
418 "Select this line's buffer, alone, in full frame."
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 (switch-to-buffer (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 (bury-buffer (other-buffer))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 (delete-other-windows))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
424 (defun Buffer-menu-mouse-select (event)
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
425 "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
426 (interactive "e")
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
427 (let (buffer)
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
428 (save-excursion
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
429 (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
430 (save-excursion
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
431 (goto-char (posn-point (event-end event)))
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
432 (setq buffer (Buffer-menu-buffer t))))
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
433 (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
434 (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
435 (eq (selected-window) (frame-root-window)))
ed3bbbdd9ef5 (Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
436 (switch-to-buffer-other-frame buffer)
ed3bbbdd9ef5 (Buffer-menu-mouse-select): Handle dedicated window.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
437 (switch-to-buffer buffer))))
6609
3b1eb7f1eba1 (Buffer-menu-mouse-select): New command.
Richard M. Stallman <rms@gnu.org>
parents: 6084
diff changeset
438
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439 (defun Buffer-menu-this-window ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 "Select this line's buffer in this window."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 (switch-to-buffer (Buffer-menu-buffer t)))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444 (defun Buffer-menu-other-window ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445 "Select this line's buffer in other window, leaving buffer menu visible."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447 (switch-to-buffer-other-window (Buffer-menu-buffer t)))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448
735
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
449 (defun Buffer-menu-switch-other-window ()
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
450 "Make the other window select this line's buffer.
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
451 The current window remains selected."
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
452 (interactive)
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
453 (display-buffer (Buffer-menu-buffer t)))
ea0823fe7df5 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 662
diff changeset
454
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 (defun Buffer-menu-2-window ()
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 "Select this line's buffer, with previous buffer in second window."
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 (interactive)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 (let ((buff (Buffer-menu-buffer t))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459 (menu (current-buffer))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 (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
461 (delete-other-windows)
194
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462 (switch-to-buffer (other-buffer))
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
463 (pop-to-buffer buff)
5b0d1a9cf37e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464 (bury-buffer menu)))
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 194
diff changeset
465
2378
c5d0140aa7b6 (Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2334
diff changeset
466 (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
467 "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
468 (interactive)
c5d0140aa7b6 (Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2334
diff changeset
469 (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
470 (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
471 (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
472 (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
473 (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
474 (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
475 (beginning-of-line)
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
476 (forward-char 1)
2378
c5d0140aa7b6 (Buffer-menu-toggle-read-only) Added, per Rob Austein's suggestion
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2334
diff changeset
477 (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
478 (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
479 (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
480 (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
481
18278
4f78346eb734 (Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents: 16401
diff changeset
482 (defun Buffer-menu-bury ()
4f78346eb734 (Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents: 16401
diff changeset
483 "Bury the buffer listed on this line."
4f78346eb734 (Buffer-menu-bury): New command.
Richard M. Stallman <rms@gnu.org>
parents: 16401
diff changeset
484 (interactive)
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
485 (when (Buffer-menu-no-header)
18280
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
486 (save-excursion
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
487 (beginning-of-line)
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
488 (bury-buffer (Buffer-menu-buffer t))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
489 (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
490 (buffer-read-only nil))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
491 (delete-region (point) (progn (forward-line -1) (point)))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
492 (goto-char (point-max))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
493 (insert line))
f693db11df45 (Buffer-menu-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 18278
diff changeset
494 (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
495
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
496
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
497 (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
498 "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
499 (interactive)
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
500 (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
501
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
502
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
503 (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
504 "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
505 (interactive)
e8ec0085ff7b (Buffer-menu-mode-map): Add V for Buffer-menu-View.
Richard M. Stallman <rms@gnu.org>
parents: 21093
diff changeset
506 (view-buffer-other-window (Buffer-menu-buffer t)))
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
507
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
508
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
509 (define-key ctl-x-map "\C-b" 'list-buffers)
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
510
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
511 (defun list-buffers (&optional files-only)
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
512 "Display a list of names of existing buffers.
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
513 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
514 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
515 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
516
40622
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
517 For more information, see the function `buffer-menu'."
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
518 (interactive "P")
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
519 (display-buffer (list-buffers-noselect files-only)))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
520
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
521 (defun Buffer-menu-buffer+size (name size &optional name-props size-props)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
522 (if (> (+ (length name) (length size) 2) Buffer-menu-buffer+size-width)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
523 (setq name
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
524 (if (string-match "<[0-9]+>$" name)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
525 (concat (substring name 0
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
526 (- Buffer-menu-buffer+size-width
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
527 (max (length size) 3)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
528 (match-end 0)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
529 (- (match-beginning 0))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
530 2))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
531 ":" ; narrow ellipsis
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
532 (match-string 0 name))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
533 (concat (substring name 0
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
534 (- Buffer-menu-buffer+size-width
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
535 (max (length size) 3)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
536 2))
49046
d6e1c5f7f468 (Buffer-menu-buffer+size): Don't clobber buffer name.
Andreas Schwab <schwab@suse.de>
parents: 48889
diff changeset
537 ":"))) ; narrow ellipsis
d6e1c5f7f468 (Buffer-menu-buffer+size): Don't clobber buffer name.
Andreas Schwab <schwab@suse.de>
parents: 48889
diff changeset
538 ;; Don't put properties on (buffer-name).
d6e1c5f7f468 (Buffer-menu-buffer+size): Don't clobber buffer name.
Andreas Schwab <schwab@suse.de>
parents: 48889
diff changeset
539 (setq name (copy-sequence name)))
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
540 (add-text-properties 0 (length name) name-props name)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
541 (add-text-properties 0 (length size) size-props size)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
542 (concat name
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
543 (make-string (- Buffer-menu-buffer+size-width
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
544 (length name)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
545 (length size))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
546 ? )
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
547 size))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
548
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
549 (defun list-buffers-noselect (&optional files-only)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
550 "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
551 The buffer is named `*Buffer List*'.
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
552 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
553 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
554
40622
d2bfc00496d7 (buffer-menu): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 40489
diff changeset
555 For more information, see the function `buffer-menu'."
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
556 (let* ((old-buffer (current-buffer))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
557 (standard-output standard-output)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
558 (mode-end (make-string (- Buffer-menu-mode-width 2) ? ))
49050
8b38bac9826a (Buffer-menu-execute): Fix for effect of header
Dave Love <fx@gnu.org>
parents: 49046
diff changeset
559 ;; Fixme: This is wrong for left-hand scroll-bars.
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
560 (header (concat "CRM " (Buffer-menu-buffer+size "Buffer" "Size")
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
561 " Mode" mode-end "File\n"))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
562 list desired-point name file mode)
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
563 (save-excursion
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
564 (set-buffer (get-buffer-create "*Buffer List*"))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
565 (setq buffer-read-only nil)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
566 (erase-buffer)
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
567 (setq standard-output (current-buffer))
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
568 (unless Buffer-menu-use-header-line
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
569 (insert header "--- ------")
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
570 (indent-to Buffer-menu-buffer+size-width)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
571 (insert "---- ----" mode-end "----\n")
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
572 (put-text-property 1 (point) 'intangible t))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
573 (setq list
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
574 (delq t
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
575 (mapcar
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
576 (lambda (buffer)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
577 (with-current-buffer buffer
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
578 (setq name (buffer-name)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
579 file (buffer-file-name))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
580 (cond
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
581 ;; Don't mention internal buffers.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
582 ((and (string= (substring name 0 1) " ") (null file)))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
583 ;; Maybe don't mention buffers without files.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
584 ((and files-only (not file)))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
585 ((string= name "*Buffer List*"))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
586 ;; Otherwise output info.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
587 (t
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
588 (unless file
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
589 ;; No visited file. Check local value of
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
590 ;; list-buffers-directory.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
591 (when (and (boundp 'list-buffers-directory)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
592 list-buffers-directory)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
593 (setq file list-buffers-directory)))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
594 (list buffer
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
595 (format "%c%c%c "
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
596 (if (eq buffer old-buffer) ?. ? )
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
597 ;; Handle readonly status. The output buffer is special
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
598 ;; cased to appear readonly; it is actually made so at a
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
599 ;; later date.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
600 (if (or (eq buffer standard-output)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
601 buffer-read-only)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
602 ?% ? )
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
603 ;; Identify modified buffers.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
604 (if (buffer-modified-p) ?* ? ))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
605 name (buffer-size) mode-name file)))))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
606 (buffer-list))))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
607 (dolist (buffer
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
608 (if Buffer-menu-sort-column
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
609 (sort list
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
610 (if (eq Buffer-menu-sort-column 3)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
611 (lambda (a b)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
612 (< (nth Buffer-menu-sort-column a)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
613 (nth Buffer-menu-sort-column b)))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
614 (lambda (a b)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
615 (string< (nth Buffer-menu-sort-column a)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
616 (nth Buffer-menu-sort-column b)))))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
617 list))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
618 (if (eq (car buffer) old-buffer)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
619 (setq desired-point (point)))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
620 (insert (cadr buffer)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
621 ;; Put the buffer name into a text property
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
622 ;; so we don't have to extract it from the text.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
623 ;; This way we avoid problems with unusual buffer names.
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
624 (Buffer-menu-buffer+size (nth 2 buffer)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
625 (int-to-string (nth 3 buffer))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
626 `(buffer-name ,(nth 2 buffer)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
627 buffer ,(car buffer)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
628 face Buffer-menu-buffer-face
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
629 mouse-face highlight
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
630 help-echo "mouse-2: select this buffer"))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
631 " "
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
632 (if (> (length (nth 4 buffer)) Buffer-menu-mode-width)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
633 (substring (nth 4 buffer) 0 Buffer-menu-mode-width)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
634 (nth 4 buffer)))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
635 (when (nth 5 buffer)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
636 (indent-to (+ Buffer-menu-buffer-column Buffer-menu-buffer+size-width
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
637 Buffer-menu-mode-width 4) 1)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
638 (princ (abbreviate-file-name (nth 5 buffer))))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
639 (princ "\n"))
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
640 (Buffer-menu-mode)
48864
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
641 (when Buffer-menu-use-header-line
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
642 (set (make-local-variable 'Buffer-menu-header-line)
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
643 (concat " " header))
02944b0aaecd (Buffer-menu, Buffer-menu-use-header-line, Buffer-menu-buffer-face,
Juanma Barranquero <lekktu@gmail.com>
parents: 40622
diff changeset
644 (setq header-line-format 'Buffer-menu-header-line))
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
645 ;; 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
646 ;; current buffer is not displayed for some reason.
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
647 (and desired-point
10592
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
648 (goto-char desired-point))
bbb68f0d31c6 (list-buffers-noselect): New subroutine.
Richard M. Stallman <rms@gnu.org>
parents: 10421
diff changeset
649 (current-buffer))))
10419
cb6f68d16210 (list-buffers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 10269
diff changeset
650
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 194
diff changeset
651 ;;; buff-menu.el ends here