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

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

Re: From global-set-key to keymap-global-set


From: uzibalqa
Subject: Re: From global-set-key to keymap-global-set
Date: Tue, 04 Jul 2023 19:40:57 +0000

------- Original Message -------
On Wednesday, July 5th, 2023 at 5:31 AM, uzibalqa <uzibalqa@proton.me> wrote:


> ------- Original Message -------
> On Wednesday, July 5th, 2023 at 4:44 AM, Eli Zaretskii eliz@gnu.org wrote:
> 
> 
> 
> > > Date: Tue, 04 Jul 2023 16:35:34 +0000
> > > From: uzibalqa uzibalqa@proton.me
> > > 
> > > Have been using "global-set-key" in this way
> > > 
> > > (global-set-key (kbd "H-e") #'eval-expression)
> > > 
> > > The documentation states that "global-set-key" is a legacy function; 
> > > instructing
> > > people that the recommended function to use is "keymap-global-set".
> > > 
> > > The problem is that one cannot use "keymap-global-set" in the same way
> > > 
> > > (keymap-global-set (kbd "H-e") #'eval-expression)
> > 
> > Are you reading the documentation of the function before you start
> > using it? If not, I highly recommend to do so.
> > 
> > In this particular case, you need to get rid of 'kbd' -- this was the
> > main reason for providing these new replacements.
> > 
> > (keymap-global-set "H-e" #'eval-expression)
> 
> 
> What does one do to replace
> 
> (global-set-key (kbd "C-;") (kbd "C-x C-;"))


I tried 

(keymap-global-set "C-;" "C-x C-;")

and it sets C-; to the command that's bound to C-x C-;

The doc string of keymap-global-set doesn't say clearly that argument COMMAND 
can be a key description (what kbd returns) of a key sequence bound to some 
command.  I recommend an improved description.




reply via email to

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