all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Misleading single "\" in Emacs Manual Section 25.3
@ 2024-07-16  8:50 Heime
  2024-07-16 10:31 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2024-07-16  8:50 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor


The Elisp documentation "25.3 Substituting Key Bindings in Documentation" states
that  each '\' must be doubled when written in a string in Emacs Lisp. 

I find this a bit confusing because the section is about writing within the documentation
string.  Meaning that the "\" should be doubled.

Using "\[COMMAND]" will not work in the documentation.  One has to use "\\[COMMAND]"

The commands in the section with a single "\" is misleading.






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

* Re: Misleading single "\" in Emacs Manual Section 25.3
  2024-07-16  8:50 Misleading single "\" in Emacs Manual Section 25.3 Heime
@ 2024-07-16 10:31 ` Eli Zaretskii
  2024-07-16 12:39   ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-07-16 10:31 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 16 Jul 2024 08:50:15 +0000
> From: Heime <heimeborgia@protonmail.com>
> 
> 
> The Elisp documentation "25.3 Substituting Key Bindings in Documentation" states
> that  each '\' must be doubled when written in a string in Emacs Lisp. 
> 
> I find this a bit confusing because the section is about writing within the documentation
> string.  Meaning that the "\" should be doubled.
> 
> Using "\[COMMAND]" will not work in the documentation.  One has to use "\\[COMMAND]"
> 
> The commands in the section with a single "\" is misleading.

I don't think they are misleading, since the text says right away that
each backslash in the forms above needs to be doubled.



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

* Misleading single "\" in Emacs Manual Section 25.3
  2024-07-16 10:31 ` Eli Zaretskii
@ 2024-07-16 12:39   ` Heime
  2024-07-16 13:36     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2024-07-16 12:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Tuesday, July 16th, 2024 at 10:31 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Tue, 16 Jul 2024 08:50:15 +0000
> > From: Heime heimeborgia@protonmail.com
> > 
> > The Elisp documentation "25.3 Substituting Key Bindings in Documentation" states
> > that each '\' must be doubled when written in a string in Emacs Lisp.
> > 
> > I find this a bit confusing because the section is about writing within the documentation
> > string. Meaning that the "\" should be doubled.
> > 
> > Using "\[COMMAND]" will not work in the documentation. One has to use "\\[COMMAND]"
> > 
> > The commands in the section with a single "\" is misleading.
> 
> 
> I don't think they are misleading, since the text says right away that
> each backslash in the forms above needs to be doubled.

It is already confusing enough on how many \ are needed for some expressions to be
printed (e.g. for regex expressions).  

When the topic is about documentation strings, the commands should conform to what
one would type in the documentation string.  

After that, it can be stated that the string processing phase will strip away one layer
of backslashes.  It would be more understandable this way.  Some readers will initially 
think that they should write \= in their string directly.





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

* Re: Misleading single "\" in Emacs Manual Section 25.3
  2024-07-16 12:39   ` Heime
@ 2024-07-16 13:36     ` Eli Zaretskii
  2024-07-16 13:53       ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-07-16 13:36 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 16 Jul 2024 12:39:08 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
> 
> > > The commands in the section with a single "\" is misleading.
> > 
> > 
> > I don't think they are misleading, since the text says right away that
> > each backslash in the forms above needs to be doubled.
> 
> It is already confusing enough on how many \ are needed for some expressions to be
> printed (e.g. for regex expressions).  
> 
> When the topic is about documentation strings, the commands should conform to what
> one would type in the documentation string.  

I disagree.

> Some readers will initially think that they should write \= in their
> string directly.

Only if they fail to pay attention to the note about doubling the
backslashes.



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

* Re: Misleading single "\" in Emacs Manual Section 25.3
  2024-07-16 13:36     ` Eli Zaretskii
@ 2024-07-16 13:53       ` Heime
  2024-07-16 14:21         ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2024-07-16 13:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Wednesday, July 17th, 2024 at 1:36 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Tue, 16 Jul 2024 12:39:08 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> > 
> > > > The commands in the section with a single "\" is misleading.
> > > 
> > > I don't think they are misleading, since the text says right away that
> > > each backslash in the forms above needs to be doubled.
> > 
> > It is already confusing enough on how many \ are needed for some expressions to be
> > printed (e.g. for regex expressions).
> > 
> > When the topic is about documentation strings, the commands should conform to what
> > one would type in the documentation string.
> 
> 
> I disagree.
> 
> > Some readers will initially think that they should write \= in their
> > string directly.
> 
> 
> Only if they fail to pay attention to the note about doubling the
> backslashes.

Or me can leave everything as is, but elaborate further about how the
processing phase of a docstring will strip away one layer of backslashes.

Then show couple of examples

  Entry        |  Interpretation
  -------------+----------------
  \\[COMMAND]  |  \[COMMAND]
  \\[\\-\\]    |  \[\-\]





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

* Re: Misleading single "\" in Emacs Manual Section 25.3
  2024-07-16 13:53       ` Heime
@ 2024-07-16 14:21         ` Heime
  2024-07-16 14:36           ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2024-07-16 14:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs, Heime

On Wednesday, July 17th, 2024 at 1:53 AM, Heime <heimeborgia@protonmail.com> wrote:

> On Wednesday, July 17th, 2024 at 1:36 AM, Eli Zaretskii eliz@gnu.org wrote:
> 
> > > Date: Tue, 16 Jul 2024 12:39:08 +0000
> > > From: Heime heimeborgia@protonmail.com
> > > Cc: help-gnu-emacs@gnu.org
> > > 
> > > > > The commands in the section with a single "\" is misleading.
> > > > 
> > > > I don't think they are misleading, since the text says right away that
> > > > each backslash in the forms above needs to be doubled.
> > > 
> > > It is already confusing enough on how many \ are needed for some expressions to be
> > > printed (e.g. for regex expressions).
> > > 
> > > When the topic is about documentation strings, the commands should conform to what
> > > one would type in the documentation string.
> > 
> > I disagree.
> > 
> > > Some readers will initially think that they should write \= in their
> > > string directly.
> > 
> > Only if they fail to pay attention to the note about doubling the
> > backslashes.
> 
> 
> Or me can leave everything as is, but elaborate further about how the
> processing phase of a docstring will strip away one layer of backslashes.
> 
> Then show couple of examples
> 
> Entry | Interpretation
> -------------+----------------
> \\[COMMAND] | \[COMMAND]
> \\[\\-\\] | \[\-\]
> 

This addition could be introduced

"When emacs processes a docstring, it removes (strips away) one
level (layer) of backslashes.  This means that each backslash
written in the docstring needs to be doubled to ensure the
correct number of backslashes are interpreted."





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

* Re: Misleading single "\" in Emacs Manual Section 25.3
  2024-07-16 14:21         ` Heime
@ 2024-07-16 14:36           ` Eli Zaretskii
  2024-07-16 15:21             ` Heime
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-07-16 14:36 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 16 Jul 2024 14:21:56 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org, Heime <heimeborgia@protonmail.com>
> 
> This addition could be introduced
> 
> "When emacs processes a docstring, it removes (strips away) one
> level (layer) of backslashes.  This means that each backslash
> written in the docstring needs to be doubled to ensure the
> correct number of backslashes are interpreted."

This is already explained where the syntax for strings in Emacs Lisp
is described in the manual.



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

* Re: Misleading single "\" in Emacs Manual Section 25.3
  2024-07-16 14:36           ` Eli Zaretskii
@ 2024-07-16 15:21             ` Heime
  2024-07-17  2:58               ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 9+ messages in thread
From: Heime @ 2024-07-16 15:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

On Wednesday, July 17th, 2024 at 2:36 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Tue, 16 Jul 2024 14:21:56 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org, Heime heimeborgia@protonmail.com
> > 
> > This addition could be introduced
> > 
> > "When emacs processes a docstring, it removes (strips away) one
> > level (layer) of backslashes. This means that each backslash
> > written in the docstring needs to be doubled to ensure the
> > correct number of backslashes are interpreted."
> 
> 
> This is already explained where the syntax for strings in Emacs Lisp
> is described in the manual.

Could you make a function where one can pass a string with the syntax one
puts in a docstring, that returns the effect of docstring processing, where 
the first layer of \ is stripped.  That would help me ouite a lot because
I am ending up with many and many \ for expressions to display as I want them.



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

* Re: Misleading single "\" in Emacs Manual Section 25.3
  2024-07-16 15:21             ` Heime
@ 2024-07-17  2:58               ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-07-17  2:58 UTC (permalink / raw)
  To: help-gnu-emacs

> Could you make a function where one can pass a string with the syntax
> one puts in a docstring, that returns the effect of docstring
> processing, where the first layer of \ is stripped.

Define precisely what you mean by "the effect of docstring processing"
and define precisely what you mean by "returns".


        Stefan


PS: There's `read` (and `read-from-string`) and its inverse `prin1`.




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

end of thread, other threads:[~2024-07-17  2:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16  8:50 Misleading single "\" in Emacs Manual Section 25.3 Heime
2024-07-16 10:31 ` Eli Zaretskii
2024-07-16 12:39   ` Heime
2024-07-16 13:36     ` Eli Zaretskii
2024-07-16 13:53       ` Heime
2024-07-16 14:21         ` Heime
2024-07-16 14:36           ` Eli Zaretskii
2024-07-16 15:21             ` Heime
2024-07-17  2:58               ` Stefan Monnier via Users list for the GNU Emacs text editor

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.