aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mackenzie2015-06-18 21:00:20 +0000
committerAlan Mackenzie2015-06-18 21:08:02 +0000
commit52c3946c872c8bd96508f74cdda5cbb90c664306 (patch)
tree30c756647f4acea5c8c6d52fe59e9f49778f7541 /src
parent711e14ddad7fb1e80a86c79e37a957929e8c01a3 (diff)
downloademacs-52c3946c872c8bd96508f74cdda5cbb90c664306.tar.gz
emacs-52c3946c872c8bd96508f74cdda5cbb90c664306.zip
Make translation of quotes to curly in doc strings optional.
src/doc.c (traditional, prefer-unicode): new symbols. (help-quote-translation): new variable. (Fsubstitute_command_keys): make translation of quotes dependent on `help-quote-translation'; also translate curly quotes back to ASCII ones. lisp/cus-start.el (top-level): Add a customization entry for `help-quote-translation'.
Diffstat (limited to 'src')
-rw-r--r--src/doc.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/doc.c b/src/doc.c
index f1ba64359a6..6794ec777ae 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -932,7 +932,8 @@ Otherwise, return a new string. */)
932 strp = SDATA (string) + idx; 932 strp = SDATA (string) + idx;
933 } 933 }
934 } 934 }
935 else if (strp[0] == '`') 935 else if ((Vhelp_quote_translation == Qprefer_unicode)
936 && (strp[0] == '`'))
936 { 937 {
937 in_quote = true; 938 in_quote = true;
938 start = (unsigned char *) "\xE2\x80\x98"; /* ‘ */ 939 start = (unsigned char *) "\xE2\x80\x98"; /* ‘ */
@@ -942,12 +943,27 @@ Otherwise, return a new string. */)
942 idx = strp - SDATA (string) + 1; 943 idx = strp - SDATA (string) + 1;
943 goto subst; 944 goto subst;
944 } 945 }
945 else if (strp[0] == '\'' && in_quote) 946 else if ((Vhelp_quote_translation == Qprefer_unicode)
947 && (strp[0] == '\'' && in_quote))
946 { 948 {
947 in_quote = false; 949 in_quote = false;
948 start = (unsigned char *) "\xE2\x80\x99"; /* ’ */ 950 start = (unsigned char *) "\xE2\x80\x99"; /* ’ */
949 goto subst_quote; 951 goto subst_quote;
950 } 952 }
953
954 else if ((Vhelp_quote_translation == Qtraditional)
955 && (strp[0] == 0xE2)
956 && (strp[1] == 0x80)
957 && ((strp[2] == 0x98) /* curly opening quote */
958 || (strp[2] == 0x99))) /* curly closing quote */
959 {
960 start = (strp[2] == 0x98) ? "`" : "'";
961 length = 1;
962 length_byte = 1;
963 idx = strp - SDATA (string) + 3;
964 goto subst;
965 }
966
951 else if (! multibyte) /* just copy other chars */ 967 else if (! multibyte) /* just copy other chars */
952 *bufp++ = *strp++, nchars++; 968 *bufp++ = *strp++, nchars++;
953 else 969 else
@@ -977,6 +993,8 @@ void
977syms_of_doc (void) 993syms_of_doc (void)
978{ 994{
979 DEFSYM (Qfunction_documentation, "function-documentation"); 995 DEFSYM (Qfunction_documentation, "function-documentation");
996 DEFSYM (Qtraditional, "traditional");
997 DEFSYM (Qprefer_unicode, "prefer-unicode");
980 998
981 DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name, 999 DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name,
982 doc: /* Name of file containing documentation strings of built-in symbols. */); 1000 doc: /* Name of file containing documentation strings of built-in symbols. */);
@@ -986,6 +1004,18 @@ syms_of_doc (void)
986 doc: /* A list of files used to build this Emacs binary. */); 1004 doc: /* A list of files used to build this Emacs binary. */);
987 Vbuild_files = Qnil; 1005 Vbuild_files = Qnil;
988 1006
1007 DEFVAR_LISP ("help-quote-translation", Vhelp_quote_translation,
1008 doc: /* How to translate quotes for display in *Help*.
1009If the value is nil (default), no translation is done.
1010If it's the symbol `traditional', any occurrences of the curly quotes
1011are translated to their ASCII "equivalents", GRAVE and APOSTROPHE.
1012If it's the symbol `prefer-unicode', any matched pairs of GRAVE and
1013APOSTROPHE will get translated into the "equivalent" curly quotes.
1014
1015Note that any translation done is done in a fresh copy of the doc
1016string, and doesn't overwrite the original characters. */);
1017 Vhelp_quote_translation = Qnil;
1018
989 defsubr (&Sdocumentation); 1019 defsubr (&Sdocumentation);
990 defsubr (&Sdocumentation_property); 1020 defsubr (&Sdocumentation_property);
991 defsubr (&Ssnarf_documentation); 1021 defsubr (&Ssnarf_documentation);