aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-02-24 09:12:56 +0000
committerRichard M. Stallman1995-02-24 09:12:56 +0000
commitfd46fd176e34b3fb94639613b764f5d698cf465d (patch)
treec78272ecd61315ac686d52b2f6122179a9f5ac93
parentbded54ddfca80faab912adda14c6162e47bb3750 (diff)
downloademacs-fd46fd176e34b3fb94639613b764f5d698cf465d.tar.gz
emacs-fd46fd176e34b3fb94639613b764f5d698cf465d.zip
(msb): Select the window that the mouse is in before
showing the menu. This makes the "Most recently used" menu more accurate. (menu-bar-update-buffers): The frame list is now an integrated part of the buffer menu. (msb--few-menus, msb--very-many-menus): Added rmail-edit-mode.
-rw-r--r--lisp/msb.el112
1 files changed, 56 insertions, 56 deletions
diff --git a/lisp/msb.el b/lisp/msb.el
index 6463db5fbdb..a28ede10d84 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -3,7 +3,7 @@
3;; 3;;
4;; Author: Lars Lindberg <Lars.Lindberg@sypro.cap.se> 4;; Author: Lars Lindberg <Lars.Lindberg@sypro.cap.se>
5;; Created: 8 Oct 1993 5;; Created: 8 Oct 1993
6;; Lindberg's last update version: 3.28 6;; Lindberg's last update version: 3.31
7;; Keywords: mouse buffer menu 7;; Keywords: mouse buffer menu
8;; 8;;
9;; This program is free software; you can redistribute it and/or modify 9;; This program is free software; you can redistribute it and/or modify
@@ -53,31 +53,27 @@
53 53
54;; Known bugs: 54;; Known bugs:
55;; - Files-by-directory 55;; - Files-by-directory
56;; + No possibility to show client/changed buffers separately 56;; + No possibility to show client/changed buffers separately.
57;; + All file buffers only appear in in a file sub-menu, they will
58;; for instance not appear in the Mail sub-menu.
59
57;; Future enhancements: 60;; Future enhancements:
58;; - [Mattes] had a suggestion about sorting files by extension.
59;; I (Lars Lindberg) think this case could be solved if msb.el was
60;; rewritten to handle more dynamic splitting. It's now completely
61;; static, depending on the menu-cond. If the splitting could also
62;; be done by a user-defined function a lot of cases would be
63;; solved.
64;; - [Jim] suggested that the Frame menu became a part of the buffer menu.
65 61
66;;; Thanks goes to 62;;; Thanks goes to
67;; [msb] - Mark Brader <msb@sq.com> 63;; Mark Brader <msb@sq.com>
68;; [Chalupsky] - Hans Chalupsky <hans@cs.Buffalo.EDU> 64;; Jim Berry <m1jhb00@FRB.GOV>
69;; [jim] - Jim Berry <m1jhb00@FRB.GOV> 65;; Hans Chalupsky <hans@cs.Buffalo.EDU>
70;; [larry] - Larry Rosenberg <ljr@ictv.com> 66;; Larry Rosenberg <ljr@ictv.com>
71;; [will] - Will Henney <will@astroscu.unam.mx> 67;; Will Henney <will@astroscu.unam.mx>
72;; [jaalto] - Jari Aalto <jaalto@tre.tele.nokia.fi> 68;; Jari Aalto <jaalto@tre.tele.nokia.fi>
73;; [kifer] - Michael Kifer <kifer@sbkifer.cs.sunysb.edu> 69;; Michael Kifer <kifer@sbkifer.cs.sunysb.edu>
74;; [Gael] - Gael Marziou <gael@gnlab030.grenoble.hp.com> 70;; Gael Marziou <gael@gnlab030.grenoble.hp.com>
75;; [Gillespie] - Dave Gillespie <daveg@thymus.synaptics.com> 71;; Dave Gillespie <daveg@thymus.synaptics.com>
76;; [Alon] - Alon Albert <alon@milcse.rtsg.mot.com> 72;; Alon Albert <alon@milcse.rtsg.mot.com>
77;; [KevinB] - Kevin Broadey, <KevinB@bartley.demon.co.uk> 73;; Kevin Broadey, <KevinB@bartley.demon.co.uk>
78;; [Ake] - Ake Stenhof <ake@cadpoint.se> 74;; Ake Stenhof <ake@cadpoint.se>
79;; [RMS] - Richard Stallman <rms@gnu.ai.mit.edu> 75;; Richard Stallman <rms@gnu.ai.mit.edu>
80;; [Fisk] - Steve Fisk <fisk@medved.bowdoin.edu> 76;; Steve Fisk <fisk@medved.bowdoin.edu>
81 77
82;;; Code: 78;;; Code:
83 79
@@ -110,7 +106,7 @@
110 ((eq major-mode 'w3-mode) 106 ((eq major-mode 'w3-mode)
111 4020 107 4020
112 "WWW (%d)") 108 "WWW (%d)")
113 ((or (memq major-mode '(rmail-mode vm-summary-mode vm-mode mail-mode)) 109 ((or (memq major-mode '(rmail-mode rmail-edit-mode vm-summary-mode vm-mode mail-mode))
114 (memq major-mode '(mh-letter-mode 110 (memq major-mode '(mh-letter-mode
115 mh-show-mode 111 mh-show-mode
116 mh-folder-mode)) 112 mh-folder-mode))
@@ -165,7 +161,7 @@
165 ((eq major-mode 'w3-mode) 161 ((eq major-mode 'w3-mode)
166 4020 162 4020
167 "WWW (%d)") 163 "WWW (%d)")
168 ((or (memq major-mode '(rmail-mode vm-summary-mode vm-mode mail-mode)) 164 ((or (memq major-mode '(rmail-mode rmail-edit-mode vm-summary-mode vm-mode mail-mode))
169 (memq major-mode '(mh-letter-mode 165 (memq major-mode '(mh-letter-mode
170 mh-show-mode 166 mh-show-mode
171 mh-folder-mode)) 167 mh-folder-mode))
@@ -421,11 +417,13 @@ selects that window.
421See the function `mouse-select-buffer' and the variable 417See the function `mouse-select-buffer' and the variable
422`msb-menu-cond' for more information about how the menus are split." 418`msb-menu-cond' for more information about how the menus are split."
423 (interactive "e") 419 (interactive "e")
424 (let ((buffer (mouse-select-buffer event)) 420 (let ((old-window (selected-window))
425 (window (posn-window (event-start event)))) 421 (window (posn-window (event-start event))))
426 (when buffer 422 (unless (framep window) (select-window window))
427 (unless (framep window) (select-window window)) 423 (let ((buffer (mouse-select-buffer event)))
428 (switch-to-buffer buffer))) 424 (if buffer
425 (switch-to-buffer buffer)
426 (select-window old-window))))
429 nil) 427 nil)
430 428
431;;; 429;;;
@@ -683,9 +681,10 @@ If the argument is left out or nil, then the current buffer is considered."
683(defun msb--most-recently-used-menu (max-buffer-name-length) 681(defun msb--most-recently-used-menu (max-buffer-name-length)
684 (when (and (numberp msb-display-most-recently-used) 682 (when (and (numberp msb-display-most-recently-used)
685 (> msb-display-most-recently-used 0)) 683 (> msb-display-most-recently-used 0))
686 (let* ((most-recently-used 684 (let* ((buffers (cdr (buffer-list)))
685 (most-recently-used
687 (loop with n = 0 686 (loop with n = 0
688 for buffer in (cdr (buffer-list)) 687 for buffer in buffers
689 if (save-excursion 688 if (save-excursion
690 (set-buffer buffer) 689 (set-buffer buffer)
691 (and (not (msb-invisible-buffer-p)) 690 (and (not (msb-invisible-buffer-p))
@@ -939,40 +938,41 @@ variable `msb-menu-cond'."
939 (or (not (fboundp 'frame-or-buffer-changed-p)) 938 (or (not (fboundp 'frame-or-buffer-changed-p))
940 (frame-or-buffer-changed-p) 939 (frame-or-buffer-changed-p)
941 arg)) 940 arg))
942 (let ((buffers (buffer-list)) 941 (let ((frames (frame-list))
943 (frames (frame-list))
944 buffers-menu frames-menu) 942 buffers-menu frames-menu)
945 ;; If requested, list only the N most recently selected buffers.
946 (when (and (integerp buffers-menu-max-size)
947 (> buffers-menu-max-size 1)
948 (> (length buffers) buffers-menu-max-size))
949 (setcdr (nthcdr buffers-menu-max-size buffers) nil))
950 ;; Make the menu of buffers proper. 943 ;; Make the menu of buffers proper.
951 (setq msb--last-buffer-menu (msb--create-buffer-menu)) 944 (setq msb--last-buffer-menu (msb--create-buffer-menu))
952 (setq buffers-menu msb--last-buffer-menu) 945 (setq buffers-menu msb--last-buffer-menu)
953 ;; Make a Frames menu if we have more than one frame. 946 ;; Make a Frames menu if we have more than one frame.
954 (if (cdr frames) 947 (when (cdr frames)
948 (let* ((frame-length (length frames))
949 (f-title (format "Frames (%d)" frame-length)))
950 ;; List only the N most recently selected frames
951 (when (and (integerp msb-max-menu-items)
952 (> msb-max-menu-items 1)
953 (> frame-length msb-max-menu-items))
954 (setcdr (nthcdr msb-max-menu-items frames) nil))
955 (setq frames-menu 955 (setq frames-menu
956 (cons "Select Frame" 956 (nconc
957 (mapcar 957 (list 'frame f-title '(nil) 'keymap f-title)
958 (function 958 (mapcar
959 (lambda (frame) 959 (function
960 (nconc 960 (lambda (frame)
961 (list frame 961 (nconc
962 (cdr (assq 'name 962 (list frame
963 (frame-parameters frame))) 963 (cdr (assq 'name
964 (cons nil nil)) 964 (frame-parameters frame)))
965 'menu-bar-select-frame))) 965 (cons nil nil))
966 frames)))) 966 'menu-bar-select-frame)))
967 (when frames-menu 967 frames)))))
968 (setq frames-menu (cons 'keymap frames-menu)))
969 (define-key (current-global-map) [menu-bar buffer] 968 (define-key (current-global-map) [menu-bar buffer]
970 (cons "Buffers" 969 (cons "Buffers"
971 (if (and buffers-menu frames-menu) 970 (if (and buffers-menu frames-menu)
972 (list 'keymap "Buffers and Frames" 971 ;; Combine Frame and Buffers menus with separator between
973 (cons 'buffers (cons "Buffers" buffers-menu)) 972 (nconc (list 'keymap "Buffers and Frames" frames-menu
974 (cons 'frames (cons "Frames" frames-menu))) 973 (and msb-separator-diff '(separator "---")))
975 (or buffers-menu frames-menu 'undefined))))))) 974 (cddr buffers-menu))
975 (or buffers-menu 'undefined)))))))
976 976
977(when (and (boundp 'menu-bar-update-hook) 977(when (and (boundp 'menu-bar-update-hook)
978 (not (fboundp 'frame-or-buffer-changed-p))) 978 (not (fboundp 'frame-or-buffer-changed-p)))