Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstrings should not double-escape strings #320

Open
yuhan0 opened this issue May 11, 2023 · 0 comments
Open

Docstrings should not double-escape strings #320

yuhan0 opened this issue May 11, 2023 · 0 comments

Comments

@yuhan0
Copy link
Contributor

yuhan0 commented May 11, 2023

As pointed out in #197 (comment), when a docstring contains a quoted string, the contents of that string should already be double-escaped such that its printed representation is correctly escaped (and can be copy-pasted etc.).
This is the case for all built-in Emacs docs, I was especially tripped up by this section in the documentation of font-lock-keywords, rendered in helpful as:

For example, an element of the form highlights (if not already
highlighted):

 "\\\\\\=<foo\\\\\\=>"
  Discrete occurrences of "foo" in the value of the variable
  font-lock-keyword-face.

 ("fu\\\\(bar\\\\)" . 1)
  Substring "bar" within all occurrences of "fubar" in the
  value of font-lock-keyword-face.

and in its intended presentation by describe-variable as:

For example, an element of the form highlights (if not already
highlighted):

 "\\<foo\\>"
  Discrete occurrences of "foo" in the value of the variable
  ‘font-lock-keyword-face’.

 ("fu\\(bar\\)" . 1)
  Substring "bar" within all occurrences of "fubar" in the
  value of ‘font-lock-keyword-face’.

The motivating example for the change was in fact an inaccuracy in one of Counsel's docstrings, and has since been fixed:abo-abo/swiper@1160924

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant