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

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

Re: don't hard-code keys


From: Thibaut Verron
Subject: Re: don't hard-code keys
Date: Sun, 2 May 2021 19:28:12 +0200

On Sun, 2 May 2021, 16:48 Emanuel Berg via Users list for the GNU Emacs
text editor, <help-gnu-emacs@gnu.org> wrote:

> Tassilo Horn wrote:
>
> >> But the question: how can I avoid hard-coding the C-u key
> >> but instead have the keybinding inserted thru a reference
> >> to the function, i.e. `universal-argument'?
> >
> > You mean, in the `message' call?  Have a look at
> >
> >   (info "(elisp) Keys in Documentation")
>
> I have it working in docstrings but not in general, for
> example this
>
>   ‘\[COMMAND]’
>        stands for a key sequence that will invoke COMMAND, or ‘M-x
>        COMMAND’ if COMMAND has no key bindings.
>
> sounds like what I want but
>
>   (substitute-command-keys "\[universal-argument]")
>
> :(
>

You need to escape the backslash, otherwise \[ just becomes [ in the
string.


reply via email to

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