2012-05-12 Chong Yidong <cyd@gnu.org>
* buff-menu.el (Buffer-menu-buffer+size-width): Doc fix (Bug#11454).
+ (Buffer-menu-mouse-select): Restore function (Bug#11459).
+ (Buffer-menu-mode-map): Bind it.
+ (Buffer-menu--pretty-name): Add a mouse-face property.
2012-05-11 Stefan Monnier <monnier@iro.umontreal.ca>
(define-key map (kbd "M-s a C-s") 'Buffer-menu-isearch-buffers)
(define-key map (kbd "M-s a M-C-s") 'Buffer-menu-isearch-buffers-regexp)
+ (define-key map [mouse-2] 'Buffer-menu-mouse-select)
+ (define-key map [follow-link] 'mouse-face)
+
(define-key map [menu-bar Buffer-menu-mode] (cons (purecopy "Buffer-Menu") menu-map))
(define-key menu-map [quit]
`(menu-item ,(purecopy "Quit") quit-window
(tabulated-list-print))
buffer))
+(defun Buffer-menu-mouse-select (event)
+ "Select the buffer whose line you click on."
+ (interactive "e")
+ (select-window (posn-window (event-end event)))
+ (let ((buffer (tabulated-list-get-id (posn-point (event-end event)))))
+ (when (buffer-live-p buffer)
+ (if (and (window-dedicated-p (selected-window))
+ (eq (selected-window) (frame-root-window)))
+ (switch-to-buffer-other-frame buffer)
+ (switch-to-buffer buffer)))))
+
(defun list-buffers--refresh (&optional buffer-list old-buffer)
;; Set up `tabulated-list-format'.
(let ((name-width Buffer-menu-name-width)
(string-to-number (aref (cadr entry2) 4))))
(defun Buffer-menu--pretty-name (name)
- (propertize name 'font-lock-face 'buffer-menu-buffer))
+ (propertize name
+ 'font-lock-face 'buffer-menu-buffer
+ 'mouse-face 'highlight))
(defun Buffer-menu--pretty-file-name (file)
(cond (file