[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 32f5bf0: Allow `text-quoting-style' to be `leave',
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master 32f5bf0: Allow `text-quoting-style' to be `leave', i.e. no translation of quotes. |
Date: |
Wed, 04 May 2016 20:02:06 +0000 |
branch: master
commit 32f5bf0c29bbad6524f71079e4380b8156289551
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
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'.
---
lisp/help-fns.el | 2 +-
src/doc.c | 12 ++++++++++--
src/editfns.c | 2 ++
src/lisp.h | 3 +++
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 040152a..d1c8b2d 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -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'.
diff --git a/src/doc.c b/src/doc.c
index e1f508e..5326433 100644
--- 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\\='.
diff --git a/src/editfns.c b/src/editfns.c
index e267c2f..11a82c3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -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. */
diff --git a/src/lisp.h b/src/lisp.h
index 1fc6130..de74a47 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 32f5bf0: Allow `text-quoting-style' to be `leave', i.e. no translation of quotes.,
Alan Mackenzie <=