all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* define-key with command arguments
@ 2021-02-10 12:00 Adam Kandur via Users list for the GNU Emacs text editor
  2021-02-10 16:49 ` Omar Polo
  2021-02-10 17:37 ` Marcin Borkowski
  0 siblings, 2 replies; 3+ messages in thread
From: Adam Kandur via Users list for the GNU Emacs text editor @ 2021-02-10 12:00 UTC (permalink / raw)
  To: help-gnu-emacs

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?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: define-key with command arguments
  2021-02-10 12:00 define-key with command arguments Adam Kandur via Users list for the GNU Emacs text editor
@ 2021-02-10 16:49 ` Omar Polo
  2021-02-10 17:37 ` Marcin Borkowski
  1 sibling, 0 replies; 3+ messages in thread
From: Omar Polo @ 2021-02-10 16:49 UTC (permalink / raw)
  To: Adam Kandur; +Cc: help-gnu-emacs


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)))



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: define-key with command arguments
  2021-02-10 12:00 define-key with command arguments Adam Kandur via Users list for the GNU Emacs text editor
  2021-02-10 16:49 ` Omar Polo
@ 2021-02-10 17:37 ` Marcin Borkowski
  1 sibling, 0 replies; 3+ messages in thread
From: Marcin Borkowski @ 2021-02-10 17:37 UTC (permalink / raw)
  To: Adam Kandur; +Cc: help-gnu-emacs


On 2021-02-10, at 13:00, Adam Kandur via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> 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?

Not sure if I understand what you are trying to accomplish (and whether
you already know about what I'm going to tell you), but you might want
to check the various forms of the `interactive' form, too.

Best,

--
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-10 17:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-10 12:00 define-key with command arguments Adam Kandur via Users list for the GNU Emacs text editor
2021-02-10 16:49 ` Omar Polo
2021-02-10 17:37 ` Marcin Borkowski

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.