emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Buffer menu fix


From: Nick Roberts
Subject: Buffer menu fix
Date: Tue, 6 Sep 2005 11:58:55 +1200

Chong Yidong writes:
 > This is regarding this FOR-RELEASE item:
 > 
 >    ** The header-line buttons in the buffer list buffer should respond
 >       to Mouse-1.
 > 
 > The following patch fixes the bug and simplifies the code.  (The `if'
 > condition that checks `Buffer-menu-use-header-line' in the old code is
 > not necessary, because it does no harm to bind some extra keys.)
 > 
 > If there are no objections over the next few days, I will check it in.

 ...
 >   (defun list-buffers-noselect (&optional files-only buffer-list)
 > --- 645,663 ----
 >                             "mouse-2: sort by visited order"
 >                           "mouse-2, RET: sort by visited order"))
 >            'mouse-face 'highlight
 > !          'keymap (let ((map (make-sparse-keymap))
 > !                        (fun `(lambda (e)
 > !                                (interactive "e")
 > !                                (if e (mouse-select-window e))
 > !                                (Buffer-menu-sort ,column))))
 > !                    (define-key map [header-line mouse-1] fun)
 > !                    (define-key map [header-line mouse-2] fun)
 > !                    (define-key map [header-line down-mouse-1] 'ignore)
 > !                    (define-key map [mouse-2] fun)
 > !                    (define-key map [follow-link] 'mouse-face)
 > !                    (define-key map "\C-m"
 > !                      `(lambda () (interactive)
 > !                         (Buffer-menu-sort ,column)))
 >                      map)))

With this patch header-line buttons in the buffer list buffer certainly
respond to Mouse-1 but unfortunately they do this even when
mouse-1-click-follows-link is nil.  This i because you have added the line

 > !                    (define-key map [header-line mouse-1] fun)

I don't think

 > !                    (define-key map [follow-link] 'mouse-face)

does anything in this case possibly because map here is a text property and
not associated with a mode.

It would be best to omit the line

 > !                    (define-key map [header-line down-mouse-1] 'ignore)

because then the header line can then respond to mouse-1 clicks and still be
dragged (try it on the mode-line to see what I mean).

 > !                    (define-key map "\C-m"
 > !                      `(lambda () (interactive)
 > !                         (Buffer-menu-sort ,column)))
 
I don't see the point of this as you can't place point on the header line.

In summary, I don't see how to solve the problem (neither did the original
author presumably), all I can do is pull your solution apart.

Sorry,

Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]