all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* elementary: how to display a ' in a docstring
@ 2016-05-07 18:00 Uwe Brauer
  2016-05-07 20:23 ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2016-05-07 18:00 UTC (permalink / raw)
  To: emacs-devel

Hello

Sorry for this elementary question
But I would like to modify a doc string of a variable such that it
displays:

Please set
vc-hg-symbolic-revision-styles to '("{rev}").

So I tried

"Please set
`vc-hg-symbolic-revision-styles' to '(\"{rev}\"))), please note the `''."

But when I use describe variable, the ' of  '(\"{rev}\"))) is not
correctly displayed.

What shall I do? 
thanks

Uwe Brauer 




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

* Re: elementary: how to display a ' in a docstring
  2016-05-07 18:00 elementary: how to display a ' in a docstring Uwe Brauer
@ 2016-05-07 20:23 ` Paul Eggert
  2016-05-07 20:45   ` Uwe Brauer
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggert @ 2016-05-07 20:23 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-devel

Uwe Brauer wrote:
> "Please set `vc-hg-symbolic-revision-styles' to '(\"{rev}\"))), please note the `''."

To get the effect you asked for, quote the apostrophes like this: "Please set
`vc-hg-symbolic-revision-styles' to \\='(\"{rev}\"))), please note the `\\=''."
See the text-quoting-style documentation in the Elisp manual.

By the way, the effect you asked for is not the recommended style in Emacs
documentation strings. When discussing a Lisp value, the usual style is to give
the value instead of Lisp code that would evaluate to the value. The
abovementioned doc string could be reworded to something like "Please set
`vc-hg-symbolic-revision-styles' to the list (\"{rev}\")."



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

* Re: elementary: how to display a ' in a docstring
  2016-05-07 20:23 ` Paul Eggert
@ 2016-05-07 20:45   ` Uwe Brauer
  2016-05-07 20:52     ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2016-05-07 20:45 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Uwe Brauer, emacs-devel

>>> "Paul" == Paul Eggert <eggert@cs.ucla.edu> writes:

   > Uwe Brauer wrote:
   >> "Please set `vc-hg-symbolic-revision-styles' to '(\"{rev}\"))),
   >> please note the `''."

   > To get the effect you asked for, quote the apostrophes like this:
   > "Please set `vc-hg-symbolic-revision-styles' to \\='(\"{rev}\"))),
   > please note the `\\=''." See the text-quoting-style documentation
   > in the Elisp manual.

thanks


   > By the way, the effect you asked for is not the recommended style in Emacs
   > documentation strings. When discussing a Lisp value, the usual style is to give
   > the value instead of Lisp code that would evaluate to the value. The
   > abovementioned doc string could be reworded to something like "Please set
   > `vc-hg-symbolic-revision-styles' to the list (\"{rev}\")."

I am now confused. Are you saying that the setting


(setq  vc-hg-symbolic-revision-styles '("{rev}"))

Is incorrect?

What would be then correct? I am not sure that I understand your
proposed wording.

(setq  vc-hg-symbolic-revision-styles (list '("{rev}")))

Is not correct. So I am puzzled.



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

* Re: elementary: how to display a ' in a docstring
  2016-05-07 20:45   ` Uwe Brauer
@ 2016-05-07 20:52     ` Paul Eggert
  2016-05-07 21:08       ` Uwe Brauer
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggert @ 2016-05-07 20:52 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-devel

Uwe Brauer wrote:

> Are you saying that the setting
> 
> (setq  vc-hg-symbolic-revision-styles '("{rev}"))
> 
> Is incorrect?

No, because that setq form is a Lisp expression, and in Lisp the expression 'V
yields the value V, which means that the form sets the variable
vc-hg-symbolic-revision-styles to the value ("{rev}").

Quoting works for any value in Lisp code. Although there are common special
cases (e.g., integers) where the single-quote is not needed, in Lisp a
single-quote is the easiest way to quote an arbitrary value.



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

* Re: elementary: how to display a ' in a docstring
  2016-05-07 20:52     ` Paul Eggert
@ 2016-05-07 21:08       ` Uwe Brauer
  2016-05-07 21:32         ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2016-05-07 21:08 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Uwe Brauer, emacs-devel


   > Uwe Brauer wrote:

   > No, because that setq form is a Lisp expression, and in Lisp the expression 'V
   > yields the value V, which means that the form sets the variable
   > vc-hg-symbolic-revision-styles to the value ("{rev}").

   > Quoting works for any value in Lisp code. Although there are common special
   > cases (e.g., integers) where the single-quote is not needed, in Lisp a
   > single-quote is the easiest way to quote an arbitrary value.

Ok but you complained, or seemed to complained that it is not good
style. So what is the recommended setting in the case I mentioned?



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

* Re: elementary: how to display a ' in a docstring
  2016-05-07 21:08       ` Uwe Brauer
@ 2016-05-07 21:32         ` Paul Eggert
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggert @ 2016-05-07 21:32 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-devel

Uwe Brauer wrote:
> Ok but you complained, or seemed to complained that it is not good
> style. So what is the recommended setting in the case I mentioned?

If the suggested value is the singleton list ("{rev}"), then (setq
vc-hg-symbolic-revision-styles '("{rev}")) is a Lisp expression that sets the
variable to the suggested value. As that is the expression you already
mentioned, your code should be OK already.

My quibble was with the doc string you suggested. In a doc string generally the
simplest way to discuss a cons value like ("{rev}") is to write the value
without quoting it. In the rare cases where this is unclear, you can quote the
value the same way you would quote a symbol or any other piece of Lisp code in a
doc string, namely by surrounding it with ` and '.



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

end of thread, other threads:[~2016-05-07 21:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-07 18:00 elementary: how to display a ' in a docstring Uwe Brauer
2016-05-07 20:23 ` Paul Eggert
2016-05-07 20:45   ` Uwe Brauer
2016-05-07 20:52     ` Paul Eggert
2016-05-07 21:08       ` Uwe Brauer
2016-05-07 21:32         ` Paul Eggert

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.