]> code.delx.au - gnu-emacs/commitdiff
Allow `text-quoting-style' to be `leave', i.e. no translation of quotes.
authorAlan Mackenzie <acm@muc.de>
Wed, 4 May 2016 19:59:50 +0000 (19:59 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 4 May 2016 19:59:50 +0000 (19:59 +0000)
* lisp/help-fns.el (describe-function-1): Don't set coding system to UTF-8
when text-quoting-style is `leave'.

* src/lisp.h (enum text_quoting_style): Add identifier LEAVE_QUOTING_STYLE.

* src/doc.c (syms_of_doc): New symbol "leave".  Amend doc string of
`text_quoting_style'.
(text_quoting_style): Handle `leave' by returning LEAVE_QUOTING_STYLE.
(Fsubstitute_command_keys): Don't translate quotes when quoting_style is
LEAVE_QUOTING_STYLE.

* src/editfns.c (styled_format): Set quoting_style to -1 when
text-quoting-style is `leave'.

lisp/help-fns.el
src/doc.c
src/editfns.c
src/lisp.h

index 040152a2c9fc249ccc433d6eec7e6130d25d87de..d1c8b2dc478e6f9d91c13430d76372f15a2af562 100644 (file)
@@ -626,7 +626,7 @@ FILE is the file where FUNCTION was probably defined."
             ;; Avoid asking the user annoying questions if she decides
             ;; to save the help buffer, when her locale's codeset
             ;; isn't UTF-8.
-            (unless (memq text-quoting-style '(straight grave))
+            (unless (memq text-quoting-style '(leave straight grave))
               (set-buffer-file-coding-system 'utf-8))))))))
 
 ;; Add defaults to `help-fns-describe-function-functions'.
index e1f508e5014b06665eb7b8bb22e9936553c5d677..53264334ed5b3b3c0800c1c0c4d4494f21ab48b5 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -704,6 +704,8 @@ text_quoting_style (void)
       ? default_to_grave_quoting_style ()
       : EQ (Vtext_quoting_style, Qgrave))
     return GRAVE_QUOTING_STYLE;
+  else if (EQ (Vtext_quoting_style, Qleave))
+    return LEAVE_QUOTING_STYLE;
   else if (EQ (Vtext_quoting_style, Qstraight))
     return STRAIGHT_QUOTING_STYLE;
   else
@@ -988,7 +990,8 @@ Otherwise, return a new string.  */)
          int ch = STRING_CHAR_AND_LENGTH (strp, len);
          if ((ch == LEFT_SINGLE_QUOTATION_MARK
               || ch == RIGHT_SINGLE_QUOTATION_MARK)
-             && quoting_style != CURVE_QUOTING_STYLE)
+             && quoting_style != CURVE_QUOTING_STYLE
+              && quoting_style != LEAVE_QUOTING_STYLE)
            {
              *bufp++ = ((ch == LEFT_SINGLE_QUOTATION_MARK
                          && quoting_style == GRAVE_QUOTING_STYLE)
@@ -1033,6 +1036,7 @@ void
 syms_of_doc (void)
 {
   DEFSYM (Qfunction_documentation, "function-documentation");
+  DEFSYM (Qleave, "leave");
   DEFSYM (Qgrave, "grave");
   DEFSYM (Qstraight, "straight");
 
@@ -1046,7 +1050,11 @@ syms_of_doc (void)
 
   DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style,
                doc: /* Style to use for single quotes in help and messages.
-Its value should be a symbol.
+Its value should be a symbol.  It works by substituting certain single
+quotes for certain other single quotes.  This is done in help output and
+`message' output.  It is not done in `format'.
+
+`leave' means do not do any substitutions.
 `curve' means quote with curved single quotes \\=‘like this\\=’.
 `straight' means quote with straight apostrophes \\='like this\\='.
 `grave' means quote with grave accent and apostrophe \\=`like this\\='.
index e267c2f2909afa83b5680c4a7d4d3033a90dd1f8..11a82c3da7359f5f8a2865d50007e5727d5f34fb 100644 (file)
@@ -3974,6 +3974,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
       multibyte = true;
 
   int quoting_style = message ? text_quoting_style () : -1;
+  if (quoting_style == LEAVE_QUOTING_STYLE)
+    quoting_style = -1;
 
   /* If we start out planning a unibyte result,
      then discover it has to be multibyte, we jump back to retry.  */
index 1fc6130be0b1fc4f899ab31523e2d280e12fbcd5..de74a47e3d35f6b8d55488e76897a6a4bd4b7b94 100644 (file)
@@ -4198,6 +4198,9 @@ extern void syms_of_callproc (void);
 /* Defined in doc.c.  */
 enum text_quoting_style
   {
+    /* Leave quotes unchanged.  */
+    LEAVE_QUOTING_STYLE,
+
     /* Use curved single quotes ‘like this’.  */
     CURVE_QUOTING_STYLE,