Re: Buffer menu fix

2005-09-07 Thread Chong Yidong
>> Then the keymap doesn't depend on `name' or `column', so it can be created >> once and for all at the toplevel, right? > > Right! > > Chong, would you like to work on this? Yes, it's not hard. ___ Emacs-devel mailing list Emacs-devel@gnu.org http://

Re: Buffer menu fix

2005-09-07 Thread Kim F. Storm
Stefan Monnier <[EMAIL PROTECTED]> writes: >> (defun Buffer-menu-make-sort-button (name column) >> (if (equal column Buffer-menu-sort-column) (setq column nil)) >> (let* ((downname (downcase name)) >> ! (map (make-sparse-keymap))) >> ;; This keymap handles both nil and non

Re: Buffer menu fix

2005-09-07 Thread Stefan Monnier
> (defun Buffer-menu-make-sort-button (name column) > (if (equal column Buffer-menu-sort-column) (setq column nil)) > (let* ((downname (downcase name)) > ! (map (make-sparse-keymap))) > ;; This keymap handles both nil and non-nil > ;; values for Buffer-menu-use-header

Re: Buffer menu fix

2005-09-07 Thread Chong Yidong
Stefan just checked in a different fix to buff-menu.el, defining a lambda expression and interning it. This fix also has a problem: `C-h k' can't generate a hyperlink to the Lisp file: mouse-2 runs the command Buffer-menu-sort-by-name, which is an interactive Lisp function. Kim's solution

Re: Buffer menu fix

2005-09-06 Thread Chong Yidong
> Not if you use the right approach. > > Try this patch (not fully tested, but shows the principle): It works. Very clever! ___ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel

Re: Buffer menu fix

2005-09-06 Thread Kim F. Storm
Chong Yidong <[EMAIL PROTECTED]> writes: > Eli Zaretskii <[EMAIL PROTECTED]> writes: > >>> The only way I can think of to get around this is to bind to a single >>> function that tries to re-construct the value of `column' based on >>> where the mouse was clicked. But that seems like a strange th

Re: Buffer menu fix

2005-09-06 Thread Kevin Rodgers
Tomas Zerolo wrote: > Can't you attach a doc-string to an anonymous function, like so? > > `lambda (e) > ,(concat "Sort buffer by " column) > ... Obviously you can include a doc string in a lambda form. The real question is, will Emacs do the right thing with it? It looks pretty

Re: Buffer menu fix

2005-09-06 Thread Chong Yidong
Eli Zaretskii <[EMAIL PROTECTED]> writes: >> When you bind a function to a key, you can't specify any additional >> arguments to pass to that function. So you have to define one >> function for each of the possible values of `column' in the code. >> >> The only way I can think of to get around t

Re: Buffer menu fix

2005-09-06 Thread Chong Yidong
> > Why? It is much more convenient to allow users to click on a link. If > > the user wants to move the header line (which is not something that > > people do frequently, anyway), all she has to do is to move the mouse > > two milimeters to the left, outside the button. This is what people >

Re: Buffer menu fix

2005-09-06 Thread Eli Zaretskii
> From: "Richard M. Stallman" <[EMAIL PROTECTED]> > Date: Tue, 06 Sep 2005 07:22:59 -0400 > Cc: [EMAIL PROTECTED], emacs-devel@gnu.org > > I don't think it is worth spending the time to have a long discussion > about whether to use a macro to define these commands, whether they > should be lambdas

Re: Buffer menu fix

2005-09-06 Thread Richard M. Stallman
I don't think it is worth spending the time to have a long discussion about whether to use a macro to define these commands, whether they should be lambdas or have names, etc. Does the current version of the patch actually work, or is there a bug in it? _

Re: Buffer menu fix

2005-09-06 Thread Tomas Zerolo
Can't you attach a doc-string to an anonymous function, like so? `lambda (e) ,(concat "Sort buffer by " column) ... (apologies if I am babbling) regards -- tomás signature.asc Description: Digital signature ___ Emacs-devel mailing l

Re: Buffer menu fix

2005-09-06 Thread Thien-Thi Nguyen
Eli Zaretskii <[EMAIL PROTECTED]> writes: > There must be some kind of misunderstanding here. I understand that > you need to know where the mouse was clicked, but that information is > stored in the mouse event that invokes the function, so if you use > `(interactive "e")', you will have access

Re: Buffer menu fix

2005-09-05 Thread Eli Zaretskii
> Cc: emacs-devel@gnu.org > From: Chong Yidong <[EMAIL PROTECTED]> > Date: Mon, 05 Sep 2005 18:18:18 -0400 > > (defun Buffer-menu-make-sort-button (column ...) > ... > (propertize ... > 'keymap (let ((map (make-sparse-keymap)) > (fun `(lambda () >

Re: Buffer menu fix

2005-09-05 Thread Nick Roberts
> > > > 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). > > > > > > You can drag it by clicking on any part of the header line outside the > > > button text. Again, this is the same as I

Re: Buffer menu fix

2005-09-05 Thread asdf
Nick Roberts <[EMAIL PROTECTED]> writes: > > > 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 behavior is the same as Info-mode. It makes sense be

Re: Buffer menu fix

2005-09-05 Thread Nick Roberts
Chong Yidong writes: > > 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 behavior is the same as Info-mode. It makes sense because > mouse-1 on the header

Re: Buffer menu fix

2005-09-05 Thread Chong Yidong
> 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 behavior is the same as Info-mode. It makes sense because mouse-1 on the header line would not set point, as it would i

Buffer menu fix

2005-09-05 Thread Nick Roberts
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

Re: Buffer menu fix

2005-09-05 Thread Chong Yidong
> The only way I can think of to get around this is to bind to a single > function that tries to re-construct the value of `column' based on > where the mouse was clicked. But that seems like a strange thing to > do -- you're throwing away information that you had (i.e., the value > of `column'),

Re: Buffer menu fix

2005-09-05 Thread Chong Yidong
Eli Zaretskii <[EMAIL PROTECTED]> writes: >> > So may I suggest to define a real function, with a real doc string, >> > and then bind those clicks to that function? >> >> I can't see a clean way to do that, without putting in 8 function >> definitions that vary from each other by only a couple ch

Re: Buffer menu fix

2005-09-05 Thread Eli Zaretskii
> Cc: emacs-devel@gnu.org > From: Chong Yidong <[EMAIL PROTECTED]> > Date: Mon, 05 Sep 2005 08:31:27 -0400 > > > So may I suggest to define a real function, with a real doc string, > > and then bind those clicks to that function? > > I can't see a clean way to do that, without putting in 8 functi

Re: Buffer menu fix

2005-09-05 Thread Chong Yidong
Eli Zaretskii <[EMAIL PROTECTED]> writes: > I realize that the original code had the same problem, but since we > are changing it: using lambda expressions to bind mouse clicks has a > negative side effect that "C-h c", "C-h k" and similar help commands, > when used with these mouse clicks, displa

Re: Buffer menu fix

2005-09-04 Thread Eli Zaretskii
> From: Chong Yidong <[EMAIL PROTECTED]> > Date: Sun, 04 Sep 2005 15:16:34 -0400 > > 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' >

Buffer menu fix

2005-09-04 Thread Chong Yidong
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