From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: how to turn off automatic curly-quoting? Date: Sun, 02 Aug 2015 16:06:57 -0700 Organization: UCLA Computer Science Department Message-ID: <55BEA291.70402@cs.ucla.edu> References: <<36f6e67e-45d9-4eca-8302-ad9a06d138f1@default>> <<83fv41v6fh.fsf@gnu.org>> <5681a732-5741-4f56-b3d7-cb1edb739d32@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030407090302070109040607" X-Trace: ger.gmane.org 1438556847 18789 80.91.229.3 (2 Aug 2015 23:07:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Aug 2015 23:07:27 +0000 (UTC) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 03 01:07:18 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZM2Ld-0000Nt-EB for ged-emacs-devel@m.gmane.org; Mon, 03 Aug 2015 01:07:17 +0200 Original-Received: from localhost ([::1]:56974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZM2Lc-0005cr-EZ for ged-emacs-devel@m.gmane.org; Sun, 02 Aug 2015 19:07:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZM2LP-0005cm-MK for emacs-devel@gnu.org; Sun, 02 Aug 2015 19:07:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZM2LM-0006Un-BO for emacs-devel@gnu.org; Sun, 02 Aug 2015 19:07:03 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZM2LM-0006Ud-29 for emacs-devel@gnu.org; Sun, 02 Aug 2015 19:07:00 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 40C461601B7; Sun, 2 Aug 2015 16:06:59 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id tJiTDfTRrR4M; Sun, 2 Aug 2015 16:06:57 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A61751601D5; Sun, 2 Aug 2015 16:06:57 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IItcNuBhlmtH; Sun, 2 Aug 2015 16:06:57 -0700 (PDT) Original-Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 7CEDB1601B7; Sun, 2 Aug 2015 16:06:57 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 In-Reply-To: <5681a732-5741-4f56-b3d7-cb1edb739d32@default> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:188307 Archived-At: This is a multi-part message in MIME format. --------------030407090302070109040607 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Drew Adams wrote: > Does it restore the behavior as it was - everywhere? Yes and no. It does restore behavior for doc strings in traditional format that uses grave accent and apostrophe to quote. However, it does transliterate curved quotes in doc strings to grave accent and apostrophe, which is new. Presumably any such doc strings are recent introductions so this caveat shouldn't affect traditional usage. > This feature should be opt-in, not opt-out, IMHO. No, let's enable it in environments where it seems to work. That's what other GNU projects do (GCC, coreutils, etc.). The new feature is disabled by default in traditional environments that can't display curved quotes; that should be good enough. > Please consider also changing the option values so that > you can use `M-x set-variable` in a reasonable way (i.e., > without needing to know that ?` is 96 etc. - you cannot > type ?` at the prompt). Character values are not helpful > in such a context. Alan made a similar suggestion a while ago, and it's easy enough to implement. Done in the attached patch, which I pushed just now. > Also, why is the name about "translation"? Shouldn't > this option just be about what style is used for quoting > Emacs terms? That point has also been made. I changed the name to 'text-quoting-style' in the attached patch. Although it's just a name, it does have uses outside help buffers so at least the 'help' part of the name was misleading. Other Emacs packages (e.g., coreutils) use "quoting-style" but that's too generic for Emacs which has other interpretation of the word "quoting". > FWIW: The doc string of `substitute-command-keys' is > not too bad. But I find it confusing that it refers > to "left and right quote characters" as something other > than the "quotation mark" character referred to in the > doc of `help-quote-translation'. I don't see the confusion, quite possibly because I'm too close to the code. Suggestions for improved wording would be welcome. --------------030407090302070109040607 Content-Type: text/x-diff; name="0001-Redo-text-quoting-style-variable.patch" Content-Disposition: attachment; filename="0001-Redo-text-quoting-style-variable.patch" Content-Transfer-Encoding: quoted-printable >From 416d7fd2d863935b7ef4ed349f6c72f14e73dd4d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 2 Aug 2015 15:58:02 -0700 Subject: [PATCH] Redo text-quoting-style variable Rename help-quote-translation to text-quoting-style, and use symbols rather than characters as values. This follows suggestions along these lines by Alan Mackenzie in: http://lists.gnu.org/archive/html/emacs-devel/2015-06/msg00343.html and by Drew Adams in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00048.html * doc/lispref/help.texi (Keys in Documentation) * etc/NEWS: * lisp/cus-start.el (standard): * src/doc.c (Fsubstitute_command_keys, syms_of_doc): Document and/or implement the new behavior instead of the old. (syms_of_doc): New symbols 'grave' and 'straight'. --- doc/lispref/help.texi | 16 ++++++++-------- etc/NEWS | 20 ++++++++++---------- lisp/cus-start.el | 18 ++++++++++-------- src/doc.c | 27 ++++++++++++++------------- 4 files changed, 42 insertions(+), 39 deletions(-) diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 779a0d5..ca8ae3f 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -347,18 +347,18 @@ and @samp{\=3D\=3D} puts @samp{\=3D} into the outpu= t. @strong{Please note:} Each @samp{\} must be doubled when written in a string in Emacs Lisp. =20 -@defvar help-quote-translation +@defvar text-quoting-style @cindex curved quotes @cindex curly quotes The value of this variable specifies the style @code{substitute-command-keys} uses when generating left and right -quotes. If the variable's value is @code{?=E2=80=98} (U+2018 LEFT SINGL= E -QUOTATION MARK), the style is @t{=E2=80=98like this=E2=80=99} with curve= d single -quotes. If the value is @code{?'} (apostrophe), the style is @t{'like -this'} with apostrophes. If the value is @code{?`} (grave accent), -the style is @t{`like this'} with grave accent and apostrophe. The -default value @code{nil} means to use curved single quotes if -displayable, and grave accent and apostrophe otherwise. +quotes. If the variable's value is @code{curve}, the style is +@t{=E2=80=98like this=E2=80=99} with curved single quotes. If the value= is +@code{straight}, the style is @t{'like this'} with straight +apostrophes. If the value is @code{grave}, the style is @t{`like +this'} with grave accent and apostrophe. The default value @code{nil} +acts like @code{curve} if curved single quotes are displayable, and +like @code{grave} otherwise. @end defvar =20 @defun substitute-command-keys string diff --git a/etc/NEWS b/etc/NEWS index 85df716..e384d17 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -889,14 +889,14 @@ in languages like German where downcasing rules dep= end on grammar. +++ ** substitute-command-keys now replaces quotes. That is, it converts documentation strings' quoting style as per the -value of the new custom variable =E2=80=98help-quote-translation=E2=80=99= : ?=E2=80=98 means -use curved quotes (also known as curly quotes) =E2=80=98like this=E2=80=99= , ?' means -use apostrophes 'like this', ?` means use grave accent and apostrophe -`like this', and nil (default) means use curved quotes if displayable -and grave accent and apostrophe otherwise. Doc strings in source code -can use either curved quotes or grave accent and apostrophe. As -before, isolated apostrophes and characters preceded by \=3D are output -as-is. +value of the new custom variable =E2=80=98text-quoting-style=E2=80=99: =E2= =80=98curve=E2=80=99 means +use curved quotes (also known as curly quotes) =E2=80=98like this=E2=80=99= , =E2=80=98straight=E2=80=99 +means use straight apostrophes 'like this', =E2=80=98grave=E2=80=99 mean= s use grave +accent and apostrophe `like this', and nil (default) means use curved +quotes if displayable and grave accent and apostrophe otherwise. Doc +strings in source code can use either curved quotes or grave accent +and apostrophe. As before, isolated apostrophes and characters +preceded by \=3D are output as-is. =20 +++ ** The character classes [:alpha:] and [:alnum:] in regular expressions @@ -1017,8 +1017,8 @@ In the new Electric Quote mode, you can enter curve= d single quotes into documentation by typing ` and '. Outside Electric Quote mode, you can enter them by typing =E2=80=98C-x 8 [=E2=80=99 and =E2=80=98C-x = 8 ]=E2=80=99, or (if your Alt key works) by typing =E2=80=98A-[=E2=80=99 and =E2=80=98A-]=E2=80=99. A= s described above under -=E2=80=98help-quote-translation=E2=80=99, the user can specify how to di= splay doc -string quotes. +=E2=80=98text-quoting-style=E2=80=99, the user can specify how to displa= y doc string +quotes. =20 +++ ** show-help-function's arg is converted via substitute-command-keys diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 69dbf0d..7a37198 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -221,14 +221,16 @@ Leaving \"Default\" unchecked is equivalent with sp= ecifying a default of (no-redraw-on-reenter display boolean) =20 ;; doc.c - (help-quote-translation help - (choice - (character :tag "Quote with curved quotes" - :value ?=E2=80=98) - (character :tag "Quote 'like this'" :value ?\') - (character :tag "Quote `like this'" :value ?\`) - (const :tag "Quote with curved quotes if displayable, 'like th= is' otherwise" nil)) - "25.1") + (text-quoting-style + help + (choice + (const :tag "Quote with curved single quotes" curve) + (const :tag "Quote with straight apostrophes 'like this'" + straight) + (const :tag "Quote with grave accent and apostrophe `like= this'" + grave) + (const :tag "Use curved quotes if displayable, grave acce= nt and apostrophe otherwise" nil)) + "25.1") ;; dosfns.c (dos-display-scancodes display boolean) (dos-hyper-key keyboard integer) diff --git a/src/doc.c b/src/doc.c index 78a7815..36619e1 100644 --- a/src/doc.c +++ b/src/doc.c @@ -715,7 +715,7 @@ as the keymap for future \\=3D\\[COMMAND] substrings. Each \\=3D=E2=80=98 and \\=3D=E2=80=99 are replaced by left and right qu= ote. Each \\=3D` is replaced by left quote, and each ' preceded by \\=3D` and without intervening ' is replaced by right quote. Left and right quote -characters are specified by =E2=80=98help-quote-translation=E2=80=99. +characters are specified by =E2=80=98text-quoting-style=E2=80=99. =20 \\=3D\\=3D quotes the following character and is discarded; thus, \\=3D\\=3D\\=3D\\=3D puts \\=3D\\=3D into the output, \\=3D\\=3D\\=3D\\[= puts \\=3D\\[ into the output, and @@ -751,11 +751,11 @@ Otherwise, return a new string. */) GCPRO4 (string, tem, keymap, name); =20 enum { unicode, grave_accent, apostrophe } quote_translation =3D unico= de; - if (EQ (Vhelp_quote_translation, make_number ('`'))) + if (EQ (Vtext_quoting_style, Qgrave)) quote_translation =3D grave_accent; - else if (EQ (Vhelp_quote_translation, make_number ('\''))) + else if (EQ (Vtext_quoting_style, Qstraight)) quote_translation =3D apostrophe; - else if (NILP (Vhelp_quote_translation) + else if (NILP (Vtext_quoting_style) && DISP_TABLE_P (Vstandard_display_table)) { Lisp_Object dv =3D DISP_CHAR_VECTOR (XCHAR_TABLE (Vstandard_displa= y_table), @@ -1024,6 +1024,8 @@ void syms_of_doc (void) { DEFSYM (Qfunction_documentation, "function-documentation"); + DEFSYM (Qgrave, "grave"); + DEFSYM (Qstraight, "straight"); =20 DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name, doc: /* Name of file containing documentation strings of built-i= n symbols. */); @@ -1033,15 +1035,14 @@ syms_of_doc (void) doc: /* A list of files used to build this Emacs binary. = */); Vbuild_files =3D Qnil; =20 - DEFVAR_LISP ("help-quote-translation", Vhelp_quote_translation, - doc: /* Style to use for single quotes in help. -The value is a left single quote character of some style. -Quote \\=3D=E2=80=98like this\\=3D=E2=80=99 if the value is ?\\=3D=E2=80= =98 (left single quotation mark). -Quote 'like this' if the value is ?' (apostrophe). -Quote \\=3D`like this' if the value is ?\\=3D` (grave accent). -The default value is nil, which means quote with left single quotation m= ark -if displayable, and with grave accent otherwise. */); - Vhelp_quote_translation =3D Qnil; + DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style, + doc: /* Style to use for single quotes when generating te= xt. +=E2=80=98curve=E2=80=99 means quote with curved single quotes \\=3D=E2=80= =98like this\\=3D=E2=80=99. +=E2=80=98straight=E2=80=99 means quote with straight apostrophes 'like t= his'. +=E2=80=98grave=E2=80=99 means quote with grave accent and apostrophe \\=3D= `like this'. +The default value nil acts like =E2=80=98curve=E2=80=99 if curved single= quotes are +displayable, and like =E2=80=98grave=E2=80=99 otherwise. */); + Vtext_quoting_style =3D Qnil; =20 defsubr (&Sdocumentation); defsubr (&Sdocumentation_property); --=20 2.1.0 --------------030407090302070109040607--