aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert2015-08-14 15:50:35 -0700
committerPaul Eggert2015-08-14 15:55:57 -0700
commit244c801689d2f7a80480d83cd7d092d4762ebe08 (patch)
tree6a07abc8b26966002de304b3546f3ccbebb2c865 /lisp
parent293775f10555f7da7e61ed8dbdb78d72f30f7e2d (diff)
downloademacs-244c801689d2f7a80480d83cd7d092d4762ebe08.tar.gz
emacs-244c801689d2f7a80480d83cd7d092d4762ebe08.zip
Extend ‘format’ to translate curved quotes
This is a followup to the recent doc string change, and deals with diagnostics and the like. This patch is more conservative than the doc string change, in that the behavior of ‘format’ changes only if its first arg contains curved quotes and the user prefers straight or grave quotes. (Come to think of it, perhaps we should be similarly conservative with doc strings too, but that can wait.) The upside of this conservatism is that existing usage is almost surely unaffected. The downside is that we'll eventually have to change Emacs's format strings to use curved quotes in places where the user might want curved quotes, but that's a simple and mechanical translation that I'm willing to do later. (Bug#21222) * doc/lispref/help.texi (Keys in Documentation): Move description of text-quoting-style from here ... * doc/lispref/strings.texi (Formatting Strings): ... to here, and describe new behavior of ‘format’. * etc/NEWS: Describe new behavior. * lisp/calc/calc-help.el (calc-describe-thing): * lisp/emacs-lisp/derived.el (derived-mode-make-docstring): * lisp/info.el (Info-find-index-name): Use ‘concat’ rather than ‘format’ to avoid misinterpretation of recently-added curved quotes. * src/doc.c (uLSQM0, uLSQM1, uLSQM2, uRSQM0, uRSQM1, uRSQM2): Move from here ... * src/lisp.h: ... to here. * src/doc.c (text_quoting_style): New function. (Fsubstitute_command_keys): Use it. * src/editfns.c (Fformat): Implement new behavior. * src/lisp.h (enum text_quoting_style): New enum.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/calc/calc-help.el2
-rw-r--r--lisp/emacs-lisp/derived.el5
-rw-r--r--lisp/info.el6
3 files changed, 8 insertions, 5 deletions
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index b2e7df1b718..7a1a983e6b3 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -365,7 +365,7 @@ C-w Describe how there is no warranty for Calc."
365 (let (Info-history) 365 (let (Info-history)
366 (Info-goto-node (buffer-substring (match-beginning 1) (match-end 1)))) 366 (Info-goto-node (buffer-substring (match-beginning 1) (match-end 1))))
367 (let* ((string-target (or target thing)) 367 (let* ((string-target (or target thing))
368 (quoted (format "['`‘]%s['’]" (regexp-quote string-target))) 368 (quoted (concat "['`‘]" (regexp-quote string-target) "['’]"))
369 (bracketed (format "\\[%s\\]\\|(%s)\\|\\<The[ \n]%s" 369 (bracketed (format "\\[%s\\]\\|(%s)\\|\\<The[ \n]%s"
370 quoted quoted quoted))) 370 quoted quoted quoted)))
371 (or (let ((case-fold-search nil)) 371 (or (let ((case-fold-search nil))
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index ee137f1771e..1f8572b278b 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -331,9 +331,10 @@ which more-or-less shadow%s %s's corresponding table%s."
331 "\n\nThis mode " 331 "\n\nThis mode "
332 (concat 332 (concat
333 "\n\nIn addition to any hooks its parent mode " 333 "\n\nIn addition to any hooks its parent mode "
334 (if (string-match (format "[`‘]%s['â€]" 334 (if (string-match (concat "[`%‘]"
335 (regexp-quote 335 (regexp-quote
336 (symbol-name parent))) 336 (symbol-name parent))
337 "['%’]")
337 docstring) 338 docstring)
338 nil 339 nil
339 (format "`%s' " parent)) 340 (format "`%s' " parent))
diff --git a/lisp/info.el b/lisp/info.el
index 0a2206d61bf..1b02c3585b1 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3398,10 +3398,12 @@ Give an empty topic name to go to the Index node itself."
3398 (re-search-forward (format 3398 (re-search-forward (format
3399 "[a-zA-Z]+: [a-zA-Z0-9_ *&]+ %s\\( \\|$\\)" 3399 "[a-zA-Z]+: [a-zA-Z0-9_ *&]+ %s\\( \\|$\\)"
3400 (regexp-quote name)) nil t) 3400 (regexp-quote name)) nil t)
3401 (search-forward (format "['`‘]%s['’]" name) nil t) 3401 (search-forward (concat "['`‘]" name "['’]") nil t)
3402 (and (string-match "\\`.*\\( (.*)\\)\\'" name) 3402 (and (string-match "\\`.*\\( (.*)\\)\\'" name)
3403 (search-forward 3403 (search-forward
3404 (format "['`‘]%s['’]" (substring name 0 (match-beginning 1))) 3404 (concat "['`%‘]"
3405 (substring name 0 (match-beginning 1))
3406 "['%’]")
3405 nil t)) 3407 nil t))
3406 (search-forward name nil t) 3408 (search-forward name nil t)
3407 ;; Try again without the " <1>" makeinfo can append 3409 ;; Try again without the " <1>" makeinfo can append