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

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

Re: 26.1 emacs-mac 7.2; map key to interactive lisp function (command) w


From: Eli Zaretskii
Subject: Re: 26.1 emacs-mac 7.2; map key to interactive lisp function (command) with an argument
Date: Sun, 21 Oct 2018 15:26:08 +0300

> From: Van L <van@scratch.space>
> Date: Sun, 21 Oct 2018 15:18:39 +1100
> 
> I am unable to have the following work.

The problem is your global-set-key forms: the general form is

  (global-set-key KEY COMMAND)

where COMMAND is a _symbol_, like this:

  (global-set-key (kbd "C-c o") 'foo)

So you need to define an interactive function named SOMETHING:

  (defun SOMETHING (...)
    (interactive)
    ...)

then bind it to a key:

  (global-set-key (kbd "C-c o") 'SOMETHING)

> The elisp documentation has for me the problem of tl;dr and after 
> experimenting with a few paragraphs and failing I want to ask how to get this 
> done. I wonder sometimes if the documentation is obtuse by design to steal 
> time.

Please tell which part of the documentation confused you.  The doc
string of global-set-key says:

  COMMAND is the command definition to use; usually it is
  a symbol naming an interactively-callable function.

IOW, it usually should be a symbol, whereas in your example it is a
list that calls a function.



reply via email to

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