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

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

Re: Introducing a regexp in a docstring brings up M-x


From: Stephen Berman
Subject: Re: Introducing a regexp in a docstring brings up M-x
Date: Sun, 14 Jul 2024 00:52:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Sat, 13 Jul 2024 16:36:05 +0000 Heime <heimeborgia@protonmail.com> wrote:

> I have introduced the following in the function docstring
>
> 1. First Capturing Group \*\\(\\s-*\\[\\-\\]\\s-*\\)\*
>
> Why do I get M-x cropping up ?
>
> 1. First Capturing Group "\(\s-*\M-x \-\\\s-*\)"

This is because in doc strings the string "\\[COMMAND]" is converted by
substitute-command-keys either into the key sequence bound to COMMAND or
else into "M-x COMMAND", as in your case.  To avoid this, use the escape
sequence "\\=": "1. First Capturing Group \\(\\s-*\\=\\[\\-\\]\\s-*\\)".

Steve Berman



reply via email to

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