comparison lisp/buff-menu.el @ 2736:d6ff54640930

(buffer-menu): Don't save a window config. (Buffer-menu-select): Don't call Buffer-menu-execute. Don't restore a window config.
author Richard M. Stallman <rms@gnu.org>
date Mon, 10 May 1993 16:31:21 +0000
parents 4ecde980a8f5
children 507f64624555
comparison
equal deleted inserted replaced
2735:6489c9da34b9 2736:d6ff54640930
30 30
31 ;;; Change Log: 31 ;;; Change Log:
32 32
33 ;; Merged by esr with recent mods to Emacs 19 buff-menu, 23 Mar 1993 33 ;; Merged by esr with recent mods to Emacs 19 buff-menu, 23 Mar 1993
34 ;; 34 ;;
35 ;; Modified by Bob Weiner, Motorola, Inc., 3/1/89
36 ;;
37 ;; Save window configuration when 'buffer-menu' is called so that
38 ;; previous window configuration is restored. prior to selecting
39 ;; buffers.
40 ;; Made 'Buffer-menu-select' also perform a 'Buffer-menu-execute'.
41 ;;
42 ;; Modified by Bob Weiner, Motorola, Inc., 4/14/89 35 ;; Modified by Bob Weiner, Motorola, Inc., 4/14/89
43 ;; 36 ;;
44 ;; Added optional backup argument to 'Buffer-menu-unmark' to make it undelete 37 ;; Added optional backup argument to 'Buffer-menu-unmark' to make it undelete
45 ;; current entry and then move to previous one. 38 ;; current entry and then move to previous one.
46 ;; 39 ;;
47 ;; Based on FSF code dating back to 1985. 40 ;; Based on FSF code dating back to 1985.
48 41
49 ;;; Code: 42 ;;; Code:
50 43
51 (defvar *buff-window-config* nil 44 ;;;Not needed, now that q is now just quit and Buffer-menu-select is v.
52 "Stores window configuration upon entry of 'buffer-menu'. Used to 45 ;;;(defvar Buffer-menu-window-config nil
53 restore window configuration when only one buffer is selected.") 46 ;;; "Window configuration saved from entry to `buffer-menu'.")
54 47
55 ; Put buffer *Buffer List* into proper mode right away 48 ; Put buffer *Buffer List* into proper mode right away
56 ; so that from now on even list-buffers is enough to get a buffer menu. 49 ; so that from now on even list-buffers is enough to get a buffer menu.
57 50
58 (defvar Buffer-menu-mode-map nil "") 51 (defvar Buffer-menu-mode-map nil "")
59 52
60 (if Buffer-menu-mode-map 53 (if Buffer-menu-mode-map
61 () 54 ()
62 (setq Buffer-menu-mode-map (make-keymap)) 55 (setq Buffer-menu-mode-map (make-keymap))
63 (suppress-keymap Buffer-menu-mode-map t) 56 (suppress-keymap Buffer-menu-mode-map t)
64 (define-key Buffer-menu-mode-map "q" 'Buffer-menu-select) 57 (define-key Buffer-menu-mode-map "q" 'Buffer-menu-quit)
58 (define-key Buffer-menu-mode-map "v" 'Buffer-menu-select)
65 (define-key Buffer-menu-mode-map "2" 'Buffer-menu-2-window) 59 (define-key Buffer-menu-mode-map "2" 'Buffer-menu-2-window)
66 (define-key Buffer-menu-mode-map "1" 'Buffer-menu-1-window) 60 (define-key Buffer-menu-mode-map "1" 'Buffer-menu-1-window)
67 (define-key Buffer-menu-mode-map "f" 'Buffer-menu-this-window) 61 (define-key Buffer-menu-mode-map "f" 'Buffer-menu-this-window)
68 (define-key Buffer-menu-mode-map "o" 'Buffer-menu-other-window) 62 (define-key Buffer-menu-mode-map "o" 'Buffer-menu-other-window)
69 (define-key Buffer-menu-mode-map "\C-o" 'Buffer-menu-switch-other-window) 63 (define-key Buffer-menu-mode-map "\C-o" 'Buffer-menu-switch-other-window)
155 With argument, show only buffers that are visiting files. 149 With argument, show only buffers that are visiting files.
156 Type ? after invocation to get help on commands available. 150 Type ? after invocation to get help on commands available.
157 Type q immediately to make the buffer menu go away and to restore 151 Type q immediately to make the buffer menu go away and to restore
158 previous window configuration." 152 previous window configuration."
159 (interactive "P") 153 (interactive "P")
160 (setq *buff-window-config* (current-window-configuration)) 154 ;;; (setq Buffer-menu-window-config (current-window-configuration))
161 (list-buffers arg) 155 (list-buffers arg)
162 (pop-to-buffer "*Buffer List*") 156 (pop-to-buffer "*Buffer List*")
163 (forward-line 2) 157 (forward-line 2)
164 (message 158 (message
165 "Commands: d, s, x; 1, 2, m, u; delete; ~; q to quit; ? for help.")) 159 "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help."))
160
161 (defun Buffer-menu-quit ()
162 "Quit the buffer menu."
163 (interactive)
164 (let ((buffer (current-buffer)))
165 ;; Restore previous window configuration before displaying
166 ;; selected buffers.
167 (switch-to-buffer (other-buffer))
168 (bury-buffer buffer)))
166 169
167 (defun Buffer-menu-mark () 170 (defun Buffer-menu-mark ()
168 "Mark buffer on this line for being displayed by \\<Buffer-menu-mode-map>\\[Buffer-menu-select] command." 171 "Mark buffer on this line for being displayed by \\<Buffer-menu-mode-map>\\[Buffer-menu-select] command."
169 (interactive) 172 (interactive)
170 (beginning-of-line) 173 (beginning-of-line)
289 (delete-char -1) 292 (delete-char -1)
290 (insert ?\ )) 293 (insert ?\ ))
291 (or (eq tem buff) (memq tem others) (setq others (cons tem others)))) 294 (or (eq tem buff) (memq tem others) (setq others (cons tem others))))
292 (setq others (nreverse others) 295 (setq others (nreverse others)
293 tem (/ (1- (frame-height)) (1+ (length others)))) 296 tem (/ (1- (frame-height)) (1+ (length others))))
294 (Buffer-menu-execute)
295 (delete-other-windows) 297 (delete-other-windows)
296 (switch-to-buffer buff) 298 (switch-to-buffer buff)
297 (or (eq menu buff) 299 (or (eq menu buff)
298 (bury-buffer menu)) 300 (bury-buffer menu))
299 (if (equal (length others) 0) 301 (if (equal (length others) 0)
300 (progn 302 (progn
301 ;; Restore previous window configuration before displaying 303 ;;; ;; Restore previous window configuration before displaying
302 ;; selected buffers. 304 ;;; ;; selected buffers.
303 (if *buff-window-config* 305 ;;; (if Buffer-menu-window-config
304 (progn 306 ;;; (progn
305 (set-window-configuration *buff-window-config*) 307 ;;; (set-window-configuration Buffer-menu-window-config)
306 (setq *buff-window-config* nil))) 308 ;;; (setq Buffer-menu-window-config nil)))
307 (switch-to-buffer buff)) 309 (switch-to-buffer buff))
308 (while others 310 (while others
309 (split-window nil tem) 311 (split-window nil tem)
310 (other-window 1) 312 (other-window 1)
311 (switch-to-buffer (car others)) 313 (switch-to-buffer (car others))