From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Buffer menu fix Date: Mon, 05 Sep 2005 18:18:18 -0400 Message-ID: <87wtlvrwet.fsf@stupidchicken.com> References: <87slwkfxt9.fsf@stupidchicken.com> <87slwjpug0.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1125959172 8201 80.91.229.2 (5 Sep 2005 22:26:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 5 Sep 2005 22:26:12 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 06 00:26:09 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ECPOE-00070C-Ae for ged-emacs-devel@m.gmane.org; Tue, 06 Sep 2005 00:24:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECPSg-0003es-OB for ged-emacs-devel@m.gmane.org; Mon, 05 Sep 2005 18:29:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECPQn-0003IU-An for emacs-devel@gnu.org; Mon, 05 Sep 2005 18:27:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECPQg-0003Eg-41 for emacs-devel@gnu.org; Mon, 05 Sep 2005 18:27:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECPQf-0003D4-Qw for emacs-devel@gnu.org; Mon, 05 Sep 2005 18:27:05 -0400 Original-Received: from [18.95.6.46] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ECPLt-0005zl-NE; Mon, 05 Sep 2005 18:22:09 -0400 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 4E62C1E44B2; Mon, 5 Sep 2005 18:18:18 -0400 (EDT) Original-To: Eli Zaretskii In-Reply-To: (Eli Zaretskii's message of "Mon, 05 Sep 2005 23:50:29 +0300") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:42632 Archived-At: Eli Zaretskii 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 characters. >> Yuck. > > Perhaps you could use a lambda expression or a macro inside a single > function. Lisp is an interpreted language, as I'm sure you know. The code in question goes like this: (defun Buffer-menu-make-sort-button (column ...) ... (propertize ... 'keymap (let ((map (make-sparse-keymap)) (fun `(lambda () (interactive) (Buffer-menu-sort ,column)))) (define-key map [header-line mouse-1] fun) ...)) 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. I'm not sure which approach is cleaner.