From: Chong Yidong Date: Sat, 12 May 2012 15:04:11 +0000 (+0800) Subject: Fix mouse links in new Buffer Menu. X-Git-Tag: emacs-24.2.90~471^2~107 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0d90978655eb1fec42c817394a1da3ebd1903e1d;p=emacs.git Fix mouse links in new Buffer Menu. * buff-menu.el (Buffer-menu-mouse-select): Restore function. (Buffer-menu-mode-map): Bind it. (Buffer-menu--pretty-name): Add a mouse-face property. Fixes: debbugs:11459 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b0122c9c064..26c4a492fb6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,9 @@ 2012-05-12 Chong Yidong * 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 diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index cbd786bda61..0ecbba09254 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -130,6 +130,9 @@ commands.") (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 @@ -565,6 +568,17 @@ means list those buffers and no others." (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) @@ -617,7 +631,9 @@ means list those buffers and no others." (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