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 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'), only to do a lot of work find out what it was later on. > > 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 to that information inside > the function. Given this, what information is thrown away?
When you're constructing the keymap, you know what the value of `column' is that you want to pass to `(Buffer-menu-sort column)'. Column=1 lists the buffer name, column=2 lists the buffer size, etc. Your suggestion is to bind to a function, e.g., (Buffer-menu-sort-click (e) (interactive "e") ...) What this function has to do is reconstruct the value of `column' to pass to `(Buffer-menu-sort column)' -- information that you've thrown away, because all you know is the input event e. To reconstruct `column', you call (pos-row-col (event-start e)), which gives the col (character column -- not the `column' we want). Then you have to figure out that `column=1' spans col X to col Y, `column=2' spans col XX to col YY, etc. Also, you have to substract some value from the result of pos-row-col, depending on whether you are using a header line or not, because the left fringe (if the fringe is activated) and the scroll bar (if the scroll bar is on the left) may take up the first few character columns on the header line. It's a giant headache to code. _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel