diff options
| author | Alan Mackenzie | 2016-05-04 19:59:50 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2016-05-04 19:59:50 +0000 |
| commit | 32f5bf0c29bbad6524f71079e4380b8156289551 (patch) | |
| tree | 3d9270640d73442c28880296bfd6a16613c1b3d4 /src | |
| parent | 088acab3831b45e0e0749705226b8680076df4b6 (diff) | |
| download | emacs-32f5bf0c29bbad6524f71079e4380b8156289551.tar.gz emacs-32f5bf0c29bbad6524f71079e4380b8156289551.zip | |
Allow `text-quoting-style' to be `leave', i.e. no translation of quotes.
* 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'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc.c | 12 | ||||
| -rw-r--r-- | src/editfns.c | 2 | ||||
| -rw-r--r-- | src/lisp.h | 3 |
3 files changed, 15 insertions, 2 deletions
| @@ -704,6 +704,8 @@ text_quoting_style (void) | |||
| 704 | ? default_to_grave_quoting_style () | 704 | ? default_to_grave_quoting_style () |
| 705 | : EQ (Vtext_quoting_style, Qgrave)) | 705 | : EQ (Vtext_quoting_style, Qgrave)) |
| 706 | return GRAVE_QUOTING_STYLE; | 706 | return GRAVE_QUOTING_STYLE; |
| 707 | else if (EQ (Vtext_quoting_style, Qleave)) | ||
| 708 | return LEAVE_QUOTING_STYLE; | ||
| 707 | else if (EQ (Vtext_quoting_style, Qstraight)) | 709 | else if (EQ (Vtext_quoting_style, Qstraight)) |
| 708 | return STRAIGHT_QUOTING_STYLE; | 710 | return STRAIGHT_QUOTING_STYLE; |
| 709 | else | 711 | else |
| @@ -988,7 +990,8 @@ Otherwise, return a new string. */) | |||
| 988 | int ch = STRING_CHAR_AND_LENGTH (strp, len); | 990 | int ch = STRING_CHAR_AND_LENGTH (strp, len); |
| 989 | if ((ch == LEFT_SINGLE_QUOTATION_MARK | 991 | if ((ch == LEFT_SINGLE_QUOTATION_MARK |
| 990 | || ch == RIGHT_SINGLE_QUOTATION_MARK) | 992 | || ch == RIGHT_SINGLE_QUOTATION_MARK) |
| 991 | && quoting_style != CURVE_QUOTING_STYLE) | 993 | && quoting_style != CURVE_QUOTING_STYLE |
| 994 | && quoting_style != LEAVE_QUOTING_STYLE) | ||
| 992 | { | 995 | { |
| 993 | *bufp++ = ((ch == LEFT_SINGLE_QUOTATION_MARK | 996 | *bufp++ = ((ch == LEFT_SINGLE_QUOTATION_MARK |
| 994 | && quoting_style == GRAVE_QUOTING_STYLE) | 997 | && quoting_style == GRAVE_QUOTING_STYLE) |
| @@ -1033,6 +1036,7 @@ void | |||
| 1033 | syms_of_doc (void) | 1036 | syms_of_doc (void) |
| 1034 | { | 1037 | { |
| 1035 | DEFSYM (Qfunction_documentation, "function-documentation"); | 1038 | DEFSYM (Qfunction_documentation, "function-documentation"); |
| 1039 | DEFSYM (Qleave, "leave"); | ||
| 1036 | DEFSYM (Qgrave, "grave"); | 1040 | DEFSYM (Qgrave, "grave"); |
| 1037 | DEFSYM (Qstraight, "straight"); | 1041 | DEFSYM (Qstraight, "straight"); |
| 1038 | 1042 | ||
| @@ -1046,7 +1050,11 @@ syms_of_doc (void) | |||
| 1046 | 1050 | ||
| 1047 | DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style, | 1051 | DEFVAR_LISP ("text-quoting-style", Vtext_quoting_style, |
| 1048 | doc: /* Style to use for single quotes in help and messages. | 1052 | doc: /* Style to use for single quotes in help and messages. |
| 1049 | Its value should be a symbol. | 1053 | Its value should be a symbol. It works by substituting certain single |
| 1054 | quotes for certain other single quotes. This is done in help output and | ||
| 1055 | `message' output. It is not done in `format'. | ||
| 1056 | |||
| 1057 | `leave' means do not do any substitutions. | ||
| 1050 | `curve' means quote with curved single quotes \\=‘like this\\=’. | 1058 | `curve' means quote with curved single quotes \\=‘like this\\=’. |
| 1051 | `straight' means quote with straight apostrophes \\='like this\\='. | 1059 | `straight' means quote with straight apostrophes \\='like this\\='. |
| 1052 | `grave' means quote with grave accent and apostrophe \\=`like this\\='. | 1060 | `grave' means quote with grave accent and apostrophe \\=`like this\\='. |
diff --git a/src/editfns.c b/src/editfns.c index e267c2f2909..11a82c3da73 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3974,6 +3974,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 3974 | multibyte = true; | 3974 | multibyte = true; |
| 3975 | 3975 | ||
| 3976 | int quoting_style = message ? text_quoting_style () : -1; | 3976 | int quoting_style = message ? text_quoting_style () : -1; |
| 3977 | if (quoting_style == LEAVE_QUOTING_STYLE) | ||
| 3978 | quoting_style = -1; | ||
| 3977 | 3979 | ||
| 3978 | /* If we start out planning a unibyte result, | 3980 | /* If we start out planning a unibyte result, |
| 3979 | then discover it has to be multibyte, we jump back to retry. */ | 3981 | then discover it has to be multibyte, we jump back to retry. */ |
diff --git a/src/lisp.h b/src/lisp.h index 1fc6130be0b..de74a47e3d3 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4198,6 +4198,9 @@ extern void syms_of_callproc (void); | |||
| 4198 | /* Defined in doc.c. */ | 4198 | /* Defined in doc.c. */ |
| 4199 | enum text_quoting_style | 4199 | enum text_quoting_style |
| 4200 | { | 4200 | { |
| 4201 | /* Leave quotes unchanged. */ | ||
| 4202 | LEAVE_QUOTING_STYLE, | ||
| 4203 | |||
| 4201 | /* Use curved single quotes ‘like this’. */ | 4204 | /* Use curved single quotes ‘like this’. */ |
| 4202 | CURVE_QUOTING_STYLE, | 4205 | CURVE_QUOTING_STYLE, |
| 4203 | 4206 | ||