help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: define-key with command arguments


From: Omar Polo
Subject: Re: define-key with command arguments
Date: Wed, 10 Feb 2021 17:49:28 +0100
User-agent: mu4e 1.4.14; emacs 28.0.50

Adam Kandur via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> writes:

> hi everyone! is it possible to do something like his
>
> (define-derived-mode test special-mode "test"
>   (define-key test-func (kbd "SPC")     'test-func-with (arg)))
> so, i wanna pass variable in function i'm going to run with keyboard binding. 
> is it possible?

You can use closure, like

    (define-key a-keymap (kbd "SPC") (lambda ()
                                       (interactive)
                                       (test-func-with arg)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]