unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: torys.anderson@gmail.com (Tory S. Anderson),
	emacs list <help-gnu-emacs@gnu.org>
Subject: Re: Basic elisp question: bind key to function with arg
Date: Mon, 26 Jan 2015 01:16:15 +0200	[thread overview]
Message-ID: <54C5793F.7040800@yandex.ru> (raw)
In-Reply-To: <87d262ihel.fsf@gmail.com>

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.




  reply	other threads:[~2015-01-25 23:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 23:12 Basic elisp question: bind key to function with arg Tory S. Anderson
2015-01-25 23:16 ` Dmitry Gutov [this message]
2015-01-25 23:57   ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C5793F.7040800@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=help-gnu-emacs@gnu.org \
    --cc=torys.anderson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).