From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Basic elisp question: bind key to function with arg Date: Mon, 26 Jan 2015 00:57:10 +0100 Message-ID: <87r3uifm7d.fsf@wmi.amu.edu.pl> References: <87d262ihel.fsf@gmail.com> <54C5793F.7040800@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1422230255 8709 80.91.229.3 (25 Jan 2015 23:57:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2015 23:57:35 +0000 (UTC) To: "Tory S. Anderson" , emacs list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 26 00:57:31 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFX3a-0007my-K3 for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jan 2015 00:57:30 +0100 Original-Received: from localhost ([::1]:39364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFX3Z-0006Zf-Sz for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2015 18:57:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFX3N-0006Za-NW for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 18:57:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFX3K-0003W1-Iq for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 18:57:17 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:37313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFX3K-0003Vk-Ca for help-gnu-emacs@gnu.org; Sun, 25 Jan 2015 18:57:14 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 8DED34AC58; Mon, 26 Jan 2015 00:57:12 +0100 (CET) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oMrVPJfC8DvU; Mon, 26 Jan 2015 00:57:12 +0100 (CET) Original-Received: from localhost (117-116.echostar.pl [213.156.117.116]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id EF79E4AC52; Mon, 26 Jan 2015 00:57:11 +0100 (CET) In-reply-to: <54C5793F.7040800@yandex.ru> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102267 Archived-At: On 2015-01-26, at 00:16, Dmitry Gutov wrote: > On 01/26/2015 01:12 AM, torys.anderson@gmail.com (Tory S. Anderson) wrote: >> I have the following in my emacs init, and it works fine: >> >> (global-set-key [C-up] 'enlarge-window) >> (global-set-key [C-down] (lambda () (interactive) >> (enlarge-window -1))) >> >> But it seems awkward to me that I need to add all the extra just to pass a -1 arg to the function, so I'm suspecting there's a simpler way to write this. Any tips? > > No, that's how you do it. Or you create a named function doing the same, > and bind it instead. And creating a named function is imho slightly better, since the result of C-h c is not very readable with a lambda. Hth, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University