aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2015-08-23 22:38:02 -0700
committerPaul Eggert2015-08-23 22:39:06 -0700
commitfbb5531fa11d13854b274d28ccd329c9b6652cfc (patch)
tree12dae03400f11dceb50e251c8ca59d2765522adb
parenta5fd059f726f4de839d33a2813f1c98d62fc6fbe (diff)
downloademacs-fbb5531fa11d13854b274d28ccd329c9b6652cfc.tar.gz
emacs-fbb5531fa11d13854b274d28ccd329c9b6652cfc.zip
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’, create a new function ‘format-message’ that does the restyling, and using the new function instead of ‘format’ only in contexts where this seems appropriate. Problem reported by Dmitry Gutov and Andreas Schwab in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html * doc/lispref/commands.texi (Using Interactive): * doc/lispref/control.texi (Signaling Errors, Signaling Errors): * doc/lispref/display.texi (Displaying Messages, Progress): * doc/lispref/elisp.texi: * doc/lispref/help.texi (Keys in Documentation): * doc/lispref/minibuf.texi (Minibuffer Misc): * doc/lispref/strings.texi (Formatting Strings): * etc/NEWS: Document the changes. * lisp/abbrev.el (expand-region-abbrevs): * lisp/apropos.el (apropos-library): * lisp/calc/calc-ext.el (calc-record-message) (calc-user-function-list): * lisp/calc/calc-help.el (calc-describe-key, calc-full-help): * lisp/calc/calc-lang.el (math-read-big-balance): * lisp/calc/calc-store.el (calc-edit-variable): * lisp/calc/calc-units.el (math-build-units-table-buffer): * lisp/calc/calc-yank.el (calc-edit-mode): * lisp/calendar/icalendar.el (icalendar-export-region) (icalendar--add-diary-entry): * lisp/cedet/mode-local.el (mode-local-print-binding) (mode-local-describe-bindings-2): * lisp/cedet/semantic/complete.el (semantic-completion-message): * lisp/cedet/semantic/edit.el (semantic-parse-changes-failed): * lisp/cedet/semantic/wisent/comp.el (wisent-log): * lisp/cedet/srecode/insert.el (srecode-insert-show-error-report): * lisp/descr-text.el (describe-text-properties-1, describe-char): * lisp/dframe.el (dframe-message): * lisp/dired-aux.el (dired-query): * lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1): * lisp/emacs-lisp/bytecomp.el (byte-compile-log) (byte-compile-log-file, byte-compile-warn, byte-compile-form): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use) (cconv-analyze-form): * lisp/emacs-lisp/check-declare.el (check-declare-warn): * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): * lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet): * lisp/emacs-lisp/edebug.el (edebug-format): * lisp/emacs-lisp/eieio-core.el (eieio-oref): * lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message) (eldoc-message): * lisp/emacs-lisp/elint.el (elint-file, elint-log): * lisp/emacs-lisp/find-func.el (find-function-library): * lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): * lisp/emacs-lisp/nadvice.el (advice--make-docstring): * lisp/emacs-lisp/package.el (package-compute-transaction) (package-install-button-action, package-delete-button-action) (package-menu--list-to-prompt): * lisp/emacs-lisp/timer.el (timer-event-handler): * lisp/emacs-lisp/warnings.el (lwarn, warn): * lisp/emulation/viper-cmd.el: (viper-toggle-parse-sexp-ignore-comments) (viper-kill-buffer, viper-brac-function): * lisp/emulation/viper-macs.el (viper-record-kbd-macro): * lisp/facemenu.el (facemenu-add-new-face): * lisp/faces.el (face-documentation, read-face-name) (face-read-string, read-face-font, describe-face): * lisp/files.el (find-alternate-file, hack-local-variables) (hack-one-local-variable--obsolete, write-file) (basic-save-buffer, delete-directory): * lisp/format.el (format-write-file, format-find-file) (format-insert-file): * lisp/help-fns.el (help-fns--key-bindings) (help-fns--compiler-macro, help-fns--obsolete) (help-fns--interactive-only, describe-function-1) (describe-variable): * lisp/help.el (describe-mode): * lisp/info-xref.el (info-xref-output): * lisp/info.el (Info-virtual-index-find-node) (Info-virtual-index, info-apropos): * lisp/international/kkc.el (kkc-error): * lisp/international/mule-cmds.el: (select-safe-coding-system-interactively) (select-safe-coding-system, describe-input-method): * lisp/international/mule-conf.el (code-offset): * lisp/international/mule-diag.el (describe-character-set) (list-input-methods-1): * lisp/international/quail.el (quail-error): * lisp/minibuffer.el (minibuffer-message): * lisp/mpc.el (mpc--debug): * lisp/msb.el (msb--choose-menu): * lisp/net/ange-ftp.el (ange-ftp-message): * lisp/net/gnutls.el (gnutls-message-maybe): * lisp/net/newst-backend.el (newsticker--sentinel-work): * lisp/net/newst-treeview.el (newsticker--treeview-load): * lisp/net/nsm.el (nsm-query-user): * lisp/net/rlogin.el (rlogin): * lisp/net/soap-client.el (soap-warning): * lisp/net/tramp.el (tramp-debug-message): * lisp/nxml/nxml-outln.el (nxml-report-outline-error): * lisp/nxml/nxml-parse.el (nxml-parse-error): * lisp/nxml/rng-cmpct.el (rng-c-error): * lisp/nxml/rng-match.el (rng-compile-error): * lisp/nxml/rng-uri.el (rng-uri-error): * lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer): * lisp/org/org-ctags.el: (org-ctags-ask-rebuild-tags-file-then-find-tag): * lisp/proced.el (proced-log): * lisp/progmodes/ebnf2ps.el (ebnf-log): * lisp/progmodes/flymake.el (flymake-log): * lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle): * lisp/replace.el (occur-1): * lisp/simple.el (execute-extended-command) (undo-outer-limit-truncate, define-alternatives): * lisp/startup.el (command-line): * lisp/subr.el (error, user-error, add-to-list): * lisp/tutorial.el (tutorial--describe-nonstandard-key) (tutorial--find-changed-keys): * src/callint.c (Fcall_interactively): * src/editfns.c (Fmessage, Fmessage_box): Restyle the quotes of format strings intended for use as a diagnostic, when restyling seems appropriate. * lisp/subr.el (format-message): New function. * src/doc.c (Finternal__text_restyle): New function. (syms_of_doc): Define it.
-rw-r--r--doc/lispref/commands.texi2
-rw-r--r--doc/lispref/control.texi4
-rw-r--r--doc/lispref/display.texi4
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/help.texi3
-rw-r--r--doc/lispref/minibuf.texi2
-rw-r--r--doc/lispref/strings.texi8
-rw-r--r--etc/NEWS10
-rw-r--r--lisp/abbrev.el2
-rw-r--r--lisp/apropos.el4
-rw-r--r--lisp/calc/calc-ext.el4
-rw-r--r--lisp/calc/calc-help.el11
-rw-r--r--lisp/calc/calc-lang.el3
-rw-r--r--lisp/calc/calc-store.el3
-rw-r--r--lisp/calc/calc-units.el2
-rw-r--r--lisp/calc/calc-yank.el4
-rw-r--r--lisp/calendar/icalendar.el12
-rw-r--r--lisp/cedet/mode-local.el9
-rw-r--r--lisp/cedet/semantic/complete.el2
-rw-r--r--lisp/cedet/semantic/edit.el4
-rw-r--r--lisp/cedet/semantic/wisent/comp.el4
-rw-r--r--lisp/cedet/srecode/insert.el2
-rw-r--r--lisp/descr-text.el11
-rw-r--r--lisp/dframe.el4
-rw-r--r--lisp/dired-aux.el2
-rw-r--r--lisp/emacs-lisp/byte-opt.el2
-rw-r--r--lisp/emacs-lisp/bytecomp.el17
-rw-r--r--lisp/emacs-lisp/cconv.el11
-rw-r--r--lisp/emacs-lisp/check-declare.el4
-rw-r--r--lisp/emacs-lisp/checkdoc.el12
-rw-r--r--lisp/emacs-lisp/cl-macs.el4
-rw-r--r--lisp/emacs-lisp/edebug.el2
-rw-r--r--lisp/emacs-lisp/eieio-core.el2
-rw-r--r--lisp/emacs-lisp/eldoc.el4
-rw-r--r--lisp/emacs-lisp/elint.el8
-rw-r--r--lisp/emacs-lisp/find-func.el9
-rw-r--r--lisp/emacs-lisp/macroexp.el11
-rw-r--r--lisp/emacs-lisp/map-ynp.el3
-rw-r--r--lisp/emacs-lisp/nadvice.el2
-rw-r--r--lisp/emacs-lisp/package.el23
-rw-r--r--lisp/emacs-lisp/timer.el3
-rw-r--r--lisp/emacs-lisp/warnings.el8
-rw-r--r--lisp/emulation/viper-cmd.el12
-rw-r--r--lisp/emulation/viper-macs.el16
-rw-r--r--lisp/facemenu.el2
-rw-r--r--lisp/faces.el38
-rw-r--r--lisp/files.el28
-rw-r--r--lisp/format.el12
-rw-r--r--lisp/help-fns.el54
-rw-r--r--lisp/help.el5
-rw-r--r--lisp/info-xref.el4
-rw-r--r--lisp/info.el7
-rw-r--r--lisp/international/kkc.el2
-rw-r--r--lisp/international/mule-cmds.el8
-rw-r--r--lisp/international/mule-conf.el10
-rw-r--r--lisp/international/mule-diag.el25
-rw-r--r--lisp/international/quail.el2
-rw-r--r--lisp/minibuffer.el4
-rw-r--r--lisp/mpc.el4
-rw-r--r--lisp/msb.el4
-rw-r--r--lisp/net/ange-ftp.el2
-rw-r--r--lisp/net/gnutls.el2
-rw-r--r--lisp/net/newst-backend.el6
-rw-r--r--lisp/net/newst-treeview.el8
-rw-r--r--lisp/net/nsm.el2
-rw-r--r--lisp/net/rlogin.el4
-rw-r--r--lisp/net/soap-client.el3
-rw-r--r--lisp/net/tramp.el10
-rw-r--r--lisp/nxml/nxml-outln.el2
-rw-r--r--lisp/nxml/nxml-parse.el2
-rw-r--r--lisp/nxml/rng-cmpct.el2
-rw-r--r--lisp/nxml/rng-match.el2
-rw-r--r--lisp/nxml/rng-uri.el2
-rw-r--r--lisp/obsolete/iswitchb.el4
-rw-r--r--lisp/org/org-ctags.el4
-rw-r--r--lisp/proced.el2
-rw-r--r--lisp/progmodes/ebnf2ps.el2
-rw-r--r--lisp/progmodes/flymake.el2
-rw-r--r--lisp/progmodes/vhdl-mode.el11
-rw-r--r--lisp/replace.el3
-rw-r--r--lisp/simple.el30
-rw-r--r--lisp/startup.el6
-rw-r--r--lisp/subr.el15
-rw-r--r--lisp/tutorial.el9
-rw-r--r--src/callint.c1
-rw-r--r--src/doc.c62
-rw-r--r--src/editfns.c5
87 files changed, 390 insertions, 292 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index aec7674284d..593054013e6 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -211,7 +211,7 @@ argument.
211 211
212The prompt string can use @samp{%} to include previous argument values 212The prompt string can use @samp{%} to include previous argument values
213(starting with the first argument) in the prompt. This is done using 213(starting with the first argument) in the prompt. This is done using
214@code{format} (@pxref{Formatting Strings}). For example, here is how 214@code{format-message} (@pxref{Formatting Strings}). For example, here is how
215you could read the name of an existing buffer followed by a new name to 215you could read the name of an existing buffer followed by a new name to
216give to that buffer: 216give to that buffer:
217 217
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index 17d5c26897f..421f5cc530f 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -990,7 +990,7 @@ should not end with any sort of punctuation.
990 990
991@defun error format-string &rest args 991@defun error format-string &rest args
992This function signals an error with an error message constructed by 992This function signals an error with an error message constructed by
993applying @code{format} (@pxref{Formatting Strings}) to 993applying @code{format-message} (@pxref{Formatting Strings}) to
994@var{format-string} and @var{args}. 994@var{format-string} and @var{args}.
995 995
996These examples show typical uses of @code{error}: 996These examples show typical uses of @code{error}:
@@ -1009,7 +1009,7 @@ These examples show typical uses of @code{error}:
1009 1009
1010@code{error} works by calling @code{signal} with two arguments: the 1010@code{error} works by calling @code{signal} with two arguments: the
1011error symbol @code{error}, and a list containing the string returned by 1011error symbol @code{error}, and a list containing the string returned by
1012@code{format}. 1012@code{format-message}.
1013 1013
1014@strong{Warning:} If you want to use your own string as an error message 1014@strong{Warning:} If you want to use your own string as an error message
1015verbatim, don't just write @code{(error @var{string})}. If @var{string} 1015verbatim, don't just write @code{(error @var{string})}. If @var{string}
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index ae59bbbdefa..36404f4dff9 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -247,7 +247,7 @@ messages in the echo area.
247@defun message format-string &rest arguments 247@defun message format-string &rest arguments
248This function displays a message in the echo area. 248This function displays a message in the echo area.
249@var{format-string} is a format string, and @var{arguments} are the 249@var{format-string} is a format string, and @var{arguments} are the
250objects for its format specifications, like in the @code{format} 250objects for its format specifications, like in the @code{format-message}
251function (@pxref{Formatting Strings}). The resulting formatted string 251function (@pxref{Formatting Strings}). The resulting formatted string
252is displayed in the echo area; if it contains @code{face} text 252is displayed in the echo area; if it contains @code{face} text
253properties, it is displayed with the specified faces (@pxref{Faces}). 253properties, it is displayed with the specified faces (@pxref{Faces}).
@@ -375,7 +375,7 @@ reporting very fast.
375When this progress reporter is subsequently used, it will display 375When this progress reporter is subsequently used, it will display
376@var{message} in the echo area, followed by progress percentage. 376@var{message} in the echo area, followed by progress percentage.
377@var{message} is treated as a simple string. If you need it to depend 377@var{message} is treated as a simple string. If you need it to depend
378on a filename, for instance, use @code{format} before calling this 378on a filename, for instance, use @code{format-message} before calling this
379function. 379function.
380 380
381The arguments @var{min-value} and @var{max-value} should be numbers 381The arguments @var{min-value} and @var{max-value} should be numbers
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 9044fbaec56..48c531f7731 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -375,6 +375,7 @@ Strings and Characters
375* Text Comparison:: Comparing characters or strings. 375* Text Comparison:: Comparing characters or strings.
376* String Conversion:: Converting to and from characters and strings. 376* String Conversion:: Converting to and from characters and strings.
377* Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}. 377* Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}.
378* Text Restyling:: Text style conversion function.
378* Case Conversion:: Case conversion functions. 379* Case Conversion:: Case conversion functions.
379* Case Tables:: Customizing case conversion. 380* Case Tables:: Customizing case conversion.
380 381
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index ca8ae3f314a..ab884f8dc80 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -350,8 +350,7 @@ string in Emacs Lisp.
350@defvar text-quoting-style 350@defvar text-quoting-style
351@cindex curved quotes 351@cindex curved quotes
352@cindex curly quotes 352@cindex curly quotes
353The value of this variable specifies the style 353The value of this variable specifies the style used to generate text
354@code{substitute-command-keys} uses when generating left and right
355quotes. If the variable's value is @code{curve}, the style is 354quotes. If the variable's value is @code{curve}, the style is
356@t{‘like this’} with curved single quotes. If the value is 355@t{‘like this’} with curved single quotes. If the value is
357@code{straight}, the style is @t{'like this'} with straight 356@code{straight}, the style is @t{'like this'} with straight
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 24c7559c7d9..2aec149524d 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -2413,7 +2413,7 @@ arrives, whichever comes first. The variable
2413@code{minibuffer-message-timeout} specifies the number of seconds to 2413@code{minibuffer-message-timeout} specifies the number of seconds to
2414wait in the absence of input. It defaults to 2. If @var{args} is 2414wait in the absence of input. It defaults to 2. If @var{args} is
2415non-@code{nil}, the actual message is obtained by passing @var{string} 2415non-@code{nil}, the actual message is obtained by passing @var{string}
2416and @var{args} through @code{format}. @xref{Formatting Strings}. 2416and @var{args} through @code{format-message}. @xref{Formatting Strings}.
2417@end defun 2417@end defun
2418 2418
2419@deffn Command minibuffer-inactive-mode 2419@deffn Command minibuffer-inactive-mode
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index c4556cbd284..326359e1da0 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -801,7 +801,7 @@ they appear; it is called a @dfn{format string}.
801 801
802 Formatting is often useful for computing messages to be displayed. In 802 Formatting is often useful for computing messages to be displayed. In
803fact, the functions @code{message} and @code{error} provide the same 803fact, the functions @code{message} and @code{error} provide the same
804formatting feature described here; they differ from @code{format} only 804formatting feature described here; they differ from @code{format-message} only
805in how they use the result of formatting. 805in how they use the result of formatting.
806 806
807@defun format string &rest objects 807@defun format string &rest objects
@@ -815,6 +815,12 @@ are copied directly into the output, including their text properties,
815if any. 815if any.
816@end defun 816@end defun
817 817
818@defun format-message string &rest objects
819This function acts like @code{format}, except it also converts any
820curved quotes in @var{string} as per the value of
821@code{text-quoting-style}. @xref{Keys in Documentation}.
822@end defun
823
818@cindex @samp{%} in format 824@cindex @samp{%} in format
819@cindex format specification 825@cindex format specification
820 A format specification is a sequence of characters beginning with a 826 A format specification is a sequence of characters beginning with a
diff --git a/etc/NEWS b/etc/NEWS
index 42a5e14e248..90a13b75844 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -917,6 +917,12 @@ either curved quotes or grave accent and apostrophe. As before,
917isolated apostrophes and characters preceded by \= are output as-is. 917isolated apostrophes and characters preceded by \= are output as-is.
918 918
919+++ 919+++
920** Message-issuing functions ‘error’, ‘message’, etc. now convert quotes.
921They use the new ‘format-message’ function instead of plain ‘format’,
922so that they now follow user preference as per ‘text-quoting-style’ if
923their format argument contains curved quotes.
924
925+++
920** The character classes [:alpha:] and [:alnum:] in regular expressions 926** The character classes [:alpha:] and [:alnum:] in regular expressions
921now match multibyte characters using Unicode character properties. 927now match multibyte characters using Unicode character properties.
922If you want the old behavior where they matched any character with 928If you want the old behavior where they matched any character with
@@ -1039,6 +1045,10 @@ key works) by typing ‘A-[’ and ‘A-]’. As described above under
1039quotes. 1045quotes.
1040 1046
1041+++ 1047+++
1048** New function ‘format-message’ is like ‘format’ and also converts
1049curved quotes as per ‘text-quoting-style’.
1050
1051+++
1042** New ‘format’ flag ‘q’ 1052** New ‘format’ flag ‘q’
1043The new ‘q’ flag causes ‘format’ to quote the output representation as 1053The new ‘q’ flag causes ‘format’ to quote the output representation as
1044per the value of ‘text-quoting-style’. E.g., (format "%qs failed" 1054per the value of ‘text-quoting-style’. E.g., (format "%qs failed"
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 02b9fd7cd84..0ba21da70ca 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -399,7 +399,7 @@ A prefix argument means don't query; expand all abbrevs."
399 (buffer-substring-no-properties 399 (buffer-substring-no-properties
400 (save-excursion (forward-word -1) (point)) 400 (save-excursion (forward-word -1) (point))
401 pnt))) 401 pnt)))
402 (if (or noquery (y-or-n-p (format "Expand ‘%s’? " string))) 402 (if (or noquery (y-or-n-p (format-message "Expand ‘%s’? " string)))
403 (expand-abbrev))))))) 403 (expand-abbrev)))))))
404 404
405;;; Abbrev properties. 405;;; Abbrev properties.
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 0a1bc7b8583..38b583c9706 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -681,8 +681,8 @@ the output includes key-bindings of commands."
681 (apropos-symbols-internal 681 (apropos-symbols-internal
682 symbols apropos-do-all 682 symbols apropos-do-all
683 (concat 683 (concat
684 (format (substitute-command-keys 684 (format-message
685 "Library `%s' provides: %s\nand requires: %s") 685 "Library %s provides: %s\nand requires: %s"
686 file 686 file
687 (mapconcat 'apropos-library-button 687 (mapconcat 'apropos-library-button
688 (or provides '(nil)) " and ") 688 (or provides '(nil)) " and ")
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 1c40188d2b2..bd33fbeb241 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -1245,7 +1245,7 @@ calc-kill calc-kill-region calc-yank))))
1245 1245
1246 1246
1247(defun calc-record-message (tag &rest args) 1247(defun calc-record-message (tag &rest args)
1248 (let ((msg (apply 'format args))) 1248 (let ((msg (apply #'format-message args)))
1249 (message "%s" msg) 1249 (message "%s" msg)
1250 (calc-record msg tag)) 1250 (calc-record msg tag))
1251 (calc-clear-command-flag 'clear-message)) 1251 (calc-clear-command-flag 'clear-message))
@@ -1957,7 +1957,7 @@ calc-kill calc-kill-region calc-yank))))
1957 (desc 1957 (desc
1958 (if (symbolp func) 1958 (if (symbolp func)
1959 (if (= (logand kind 3) 0) 1959 (if (= (logand kind 3) 0)
1960 (format "‘%c’ = %s" key name) 1960 (format-message "‘%c’ = %s" key name)
1961 (if pos 1961 (if pos
1962 (format "%s%c%s" 1962 (format "%s%c%s"
1963 (downcase (substring name 0 pos)) 1963 (downcase (substring name 0 pos))
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index 50a0291e4cd..18c3b76c423 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -239,7 +239,7 @@ C-w Describe how there is no warranty for Calc."
239 (setq prompts (substring prompts 0 (match-beginning 0)))) 239 (setq prompts (substring prompts 0 (match-beginning 0))))
240 (if (string-match "\\` +" prompts) 240 (if (string-match "\\` +" prompts)
241 (setq prompts (substring prompts (match-end 0)))) 241 (setq prompts (substring prompts (match-end 0))))
242 (setq msg (format 242 (setq msg (format-message
243 "%s: %s%s‘%s’%s%s %s%s" 243 "%s: %s%s‘%s’%s%s %s%s"
244 (if (string-match 244 (if (string-match
245 "\\`\\(calc-[-a-zA-Z0-9]+\\) *\\(.*\\)\\'" 245 "\\`\\(calc-[-a-zA-Z0-9]+\\) *\\(.*\\)\\'"
@@ -400,8 +400,9 @@ C-w Describe how there is no warranty for Calc."
400 (princ "GNU Emacs Calculator.\n") 400 (princ "GNU Emacs Calculator.\n")
401 (princ " By Dave Gillespie.\n") 401 (princ " By Dave Gillespie.\n")
402 (princ (format " %s\n\n" emacs-copyright)) 402 (princ (format " %s\n\n" emacs-copyright))
403 (princ (format "Type ‘h s’ for a more detailed summary.\n")) 403 (princ (format-message "Type ‘h s’ for a more detailed summary.\n"))
404 (princ (format "Or type ‘h i’ to read the full Calc manual on-line.\n\n")) 404 (princ (format-message
405 "Or type ‘h i’ to read the full Calc manual on-line.\n\n"))
405 (princ "Basic keys:\n") 406 (princ "Basic keys:\n")
406 (let* ((calc-full-help-flag t)) 407 (let* ((calc-full-help-flag t))
407 (mapc (function (lambda (x) (princ (format 408 (mapc (function (lambda (x) (princ (format
@@ -415,10 +416,10 @@ C-w Describe how there is no warranty for Calc."
415 (if (car msgs) 416 (if (car msgs)
416 (princ 417 (princ
417 (if (eq (nth 2 msgs) ?v) 418 (if (eq (nth 2 msgs) ?v)
418 (format 419 (format-message
419 "\n‘v’ or ‘V’ prefix (vector/matrix) keys: \n") 420 "\n‘v’ or ‘V’ prefix (vector/matrix) keys: \n")
420 (if (nth 2 msgs) 421 (if (nth 2 msgs)
421 (format 422 (format-message
422 "\n‘%c’ prefix (%s) keys:\n" 423 "\n‘%c’ prefix (%s) keys:\n"
423 (nth 2 msgs) 424 (nth 2 msgs)
424 (or (cdr (assq (nth 2 msgs) 425 (or (cdr (assq (nth 2 msgs)
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index 9d5020df038..7f5588b6d09 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -2508,7 +2508,8 @@ order to Calc's."
2508 (while (> count 0) 2508 (while (> count 0)
2509 (if (>= h len) 2509 (if (>= h len)
2510 (if what 2510 (if what
2511 (math-read-big-error nil v (format "Unmatched ‘%s’" what)) 2511 (math-read-big-error nil v (format-message
2512 "Unmatched ‘%s’" what))
2512 (setq count 0)) 2513 (setq count 0))
2513 (if (memq (aref line h) '(?\( ?\[)) 2514 (if (memq (aref line h) '(?\( ?\[))
2514 (setq count (1+ count)) 2515 (setq count (1+ count))
diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el
index 43dc602225e..4cf5b8c3a31 100644
--- a/lisp/calc/calc-store.el
+++ b/lisp/calc/calc-store.el
@@ -442,7 +442,8 @@
442 (setq calc-last-edited-variable var) 442 (setq calc-last-edited-variable var)
443 (calc-edit-mode (list 'calc-finish-stack-edit (list 'quote var)) 443 (calc-edit-mode (list 'calc-finish-stack-edit (list 'quote var))
444 t 444 t
445 (format "Editing variable ‘%s’" (calc-var-name var))) 445 (format-message
446 "Editing variable ‘%s’" (calc-var-name var)))
446 (and value 447 (and value
447 (insert (math-format-nice-expr value (frame-width)) "\n"))))) 448 (insert (math-format-nice-expr value (frame-width)) "\n")))))
448 (calc-show-edit-buffer)) 449 (calc-show-edit-buffer))
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index d95af9492bd..d56c0b29c12 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -1622,7 +1622,7 @@ If COMP or STD is non-nil, put that in the units table instead."
1622 (while (eq (car (car (setq uptr (cdr uptr)))) 0))) 1622 (while (eq (car (car (setq uptr (cdr uptr)))) 0)))
1623 (insert "\n\n") 1623 (insert "\n\n")
1624 (insert 1624 (insert
1625 (format 1625 (format-message
1626 (concat 1626 (concat
1627 "(**) When in TeX or LaTeX display mode, the TeX specific unit\n" 1627 "(**) When in TeX or LaTeX display mode, the TeX specific unit\n"
1628 "names will not use the ‘tex’ prefix; the unit name for a\n" 1628 "names will not use the ‘tex’ prefix; the unit name for a\n"
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index d4be8ad832d..cce04705da8 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -603,9 +603,9 @@ To cancel the edit, simply kill the *Calc Edit* buffer."
603 (insert (propertize 603 (insert (propertize
604 (concat 604 (concat
605 (or title title "Calc Edit Mode. ") 605 (or title title "Calc Edit Mode. ")
606 (format "Press ‘C-c C-c’") 606 (format-message "Press ‘C-c C-c’")
607 (if allow-ret "" " or RET") 607 (if allow-ret "" " or RET")
608 (format " to finish, ‘C-x k RET’ to cancel.\n\n")) 608 (format-message " to finish, ‘C-x k RET’ to cancel.\n\n"))
609 'font-lock-face 'italic 'read-only t 'rear-nonsticky t 'front-sticky t)) 609 'font-lock-face 'italic 'read-only t 'rear-nonsticky t 'front-sticky t))
610 (make-local-variable 'calc-edit-top) 610 (make-local-variable 'calc-edit-top)
611 (setq calc-edit-top (point)))) 611 (setq calc-edit-top (point))))
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index bced4e20e02..bd78ba33b98 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -1118,10 +1118,10 @@ FExport diary data into iCalendar file: ")
1118 (setq found-error t) 1118 (setq found-error t)
1119 (save-current-buffer 1119 (save-current-buffer
1120 (set-buffer (get-buffer-create "*icalendar-errors*")) 1120 (set-buffer (get-buffer-create "*icalendar-errors*"))
1121 (insert (format "Error in line %d -- %s: ‘%s’\n" 1121 (insert (format-message "Error in line %d -- %s: ‘%s’\n"
1122 (count-lines (point-min) (point)) 1122 (count-lines (point-min) (point))
1123 error-val 1123 error-val
1124 entry-main)))))) 1124 entry-main))))))
1125 1125
1126 ;; we're done, insert everything into the file 1126 ;; we're done, insert everything into the file
1127 (save-current-buffer 1127 (save-current-buffer
@@ -2473,8 +2473,8 @@ SUMMARY is not nil it must be a string that gives the summary of the
2473entry. In this case the user will be asked whether he wants to insert 2473entry. In this case the user will be asked whether he wants to insert
2474the entry." 2474the entry."
2475 (when (or (not summary) 2475 (when (or (not summary)
2476 (y-or-n-p (format "Add appointment for ‘%s’ to diary? " 2476 (y-or-n-p (format-message "Add appointment for ‘%s’ to diary? "
2477 summary))) 2477 summary)))
2478 (when summary 2478 (when summary
2479 (setq non-marking 2479 (setq non-marking
2480 (y-or-n-p (format "Make appointment non-marking? ")))) 2480 (y-or-n-p (format "Make appointment non-marking? "))))
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el
index 3bdc3ea6155..01e37005b5d 100644
--- a/lisp/cedet/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -629,10 +629,9 @@ SYMBOL is a function that can be overridden."
629(defun mode-local-print-binding (symbol) 629(defun mode-local-print-binding (symbol)
630 "Print the SYMBOL binding." 630 "Print the SYMBOL binding."
631 (let ((value (symbol-value symbol))) 631 (let ((value (symbol-value symbol)))
632 (princ (format (substitute-command-keys "\n ‘%s’ value is\n ") 632 (princ (format-message "\n ‘%s’ value is\n " symbol))
633 symbol))
634 (if (and value (symbolp value)) 633 (if (and value (symbolp value))
635 (princ (format (substitute-command-keys "‘%s’") value)) 634 (princ (format-message "‘%s’" value))
636 (let ((pt (point))) 635 (let ((pt (point)))
637 (pp value) 636 (pp value)
638 (save-excursion 637 (save-excursion
@@ -690,7 +689,7 @@ SYMBOL is a function that can be overridden."
690 ) 689 )
691 ((symbolp buffer-or-mode) 690 ((symbolp buffer-or-mode)
692 (setq mode buffer-or-mode) 691 (setq mode buffer-or-mode)
693 (princ (format (substitute-command-keys "‘%s’\n") buffer-or-mode)) 692 (princ (format-message "‘%s’\n" buffer-or-mode))
694 ) 693 )
695 ((signal 'wrong-type-argument 694 ((signal 'wrong-type-argument
696 (list 'buffer-or-mode buffer-or-mode)))) 695 (list 'buffer-or-mode buffer-or-mode))))
@@ -700,7 +699,7 @@ SYMBOL is a function that can be overridden."
700 (while mode 699 (while mode
701 (setq table (get mode 'mode-local-symbol-table)) 700 (setq table (get mode 'mode-local-symbol-table))
702 (when table 701 (when table
703 (princ (format (substitute-command-keys "\n- From ‘%s’\n") mode)) 702 (princ (format-message "\n- From ‘%s’\n" mode))
704 (mode-local-print-bindings table)) 703 (mode-local-print-bindings table))
705 (setq mode (get-mode-local-parent mode))))) 704 (setq mode (get-mode-local-parent mode)))))
706 705
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index 509f8020c2a..ce9e3252ec8 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -156,7 +156,7 @@ Presumably if you call this you will insert something new there."
156 "Display the string FMT formatted with ARGS at the end of the minibuffer." 156 "Display the string FMT formatted with ARGS at the end of the minibuffer."
157 (if semantic-complete-inline-overlay 157 (if semantic-complete-inline-overlay
158 (apply 'message fmt args) 158 (apply 'message fmt args)
159 (message (concat (buffer-string) (apply 'format fmt args))))) 159 (message (concat (buffer-string) (apply #'format-message fmt args)))))
160 160
161;;; ------------------------------------------------------------ 161;;; ------------------------------------------------------------
162;;; MINIBUFFER: Option Selection harnesses 162;;; MINIBUFFER: Option Selection harnesses
diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el
index f207fced291..aa7131e9773 100644
--- a/lisp/cedet/semantic/edit.el
+++ b/lisp/cedet/semantic/edit.el
@@ -463,11 +463,11 @@ See `semantic-edits-change-leaf-tag' for details on parents."
463 463
464(defun semantic-parse-changes-failed (&rest args) 464(defun semantic-parse-changes-failed (&rest args)
465 "Signal that Semantic failed to parse changes. 465 "Signal that Semantic failed to parse changes.
466That is, display a message by passing all ARGS to `format', then throw 466That is, display a message by passing all ARGS to `format-message', then throw
467a 'semantic-parse-changes-failed exception with value t." 467a 'semantic-parse-changes-failed exception with value t."
468 (when semantic-edits-verbose-flag 468 (when semantic-edits-verbose-flag
469 (message "Semantic parse changes failed: %S" 469 (message "Semantic parse changes failed: %S"
470 (apply 'format args))) 470 (apply #'format-message args)))
471 (throw 'semantic-parse-changes-failed t)) 471 (throw 'semantic-parse-changes-failed t))
472 472
473(defsubst semantic-edits-incremental-fail () 473(defsubst semantic-edits-incremental-fail ()
diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el
index 2e4072f89b4..90c5ebd0095 100644
--- a/lisp/cedet/semantic/wisent/comp.el
+++ b/lisp/cedet/semantic/wisent/comp.el
@@ -230,11 +230,11 @@ Its name is defined in constant `wisent-log-buffer-name'."
230 230
231(defsubst wisent-log (&rest args) 231(defsubst wisent-log (&rest args)
232 "Insert text into the log buffer. 232 "Insert text into the log buffer.
233`format' is applied to ARGS and the result string is inserted into the 233`format-message' is applied to ARGS and the result string is inserted into the
234log buffer returned by the function `wisent-log-buffer'." 234log buffer returned by the function `wisent-log-buffer'."
235 (and wisent-new-log-flag (wisent-new-log)) 235 (and wisent-new-log-flag (wisent-new-log))
236 (with-current-buffer (wisent-log-buffer) 236 (with-current-buffer (wisent-log-buffer)
237 (insert (apply 'format args)))) 237 (insert (apply #'format-message args))))
238 238
239(defconst wisent-log-file "wisent.output" 239(defconst wisent-log-file "wisent.output"
240 "The log file. 240 "The log file.
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index c2a70fe030f..c24bd99c79c 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -216,7 +216,7 @@ insertions."
216 (data-debug-insert-thing dictionary "" "> ") 216 (data-debug-insert-thing dictionary "" "> ")
217 ;; Show the error message. 217 ;; Show the error message.
218 (insert (propertize "Error" 'face '(:weight bold)) "\n") 218 (insert (propertize "Error" 'face '(:weight bold)) "\n")
219 (insert (apply #'format format args)) 219 (insert (apply #'format-message format args))
220 (pop-to-buffer (current-buffer)))) 220 (pop-to-buffer (current-buffer))))
221 221
222(defun srecode-insert-report-error (dictionary format &rest args) 222(defun srecode-insert-report-error (dictionary format &rest args)
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 71233d406e1..825ab80f211 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -161,11 +161,8 @@ otherwise."
161 ;; Buttons 161 ;; Buttons
162 (when (and button (not (widgetp wid-button))) 162 (when (and button (not (widgetp wid-button)))
163 (newline) 163 (newline)
164 (insert (substitute-command-keys "Here is a ‘") 164 (insert (format-message "Here is a ‘%S’ button labeled ‘%s’.\n\n"
165 (format "%S" button-type) 165 button-type button-label)))
166 (substitute-command-keys "’ button labeled ‘")
167 button-label
168 (substitute-command-keys "’.\n\n")))
169 ;; Overlays 166 ;; Overlays
170 (when overlays 167 (when overlays
171 (newline) 168 (newline)
@@ -739,9 +736,7 @@ relevant to POS."
739 (when face 736 (when face
740 (insert (propertize " " 'display '(space :align-to 5)) 737 (insert (propertize " " 'display '(space :align-to 5))
741 "face: ") 738 "face: ")
742 (insert (substitute-command-keys "‘") 739 (insert (format-message "‘%s’\n" face))))))
743 (symbol-name face)
744 (substitute-command-keys "’\n"))))))
745 (insert "these terminal codes:\n") 740 (insert "these terminal codes:\n")
746 (dotimes (i (length disp-vector)) 741 (dotimes (i (length disp-vector))
747 (insert (car (aref disp-vector i)) 742 (insert (car (aref disp-vector i))
diff --git a/lisp/dframe.el b/lisp/dframe.el
index 94c1e10ddcd..d8ddbc8f08f 100644
--- a/lisp/dframe.el
+++ b/lisp/dframe.el
@@ -688,11 +688,11 @@ Optionally select that frame if necessary."
688Argument FMT is the format string, and ARGS are the arguments for message." 688Argument FMT is the format string, and ARGS are the arguments for message."
689 (save-selected-window 689 (save-selected-window
690 (if dframe-suppress-message-flag 690 (if dframe-suppress-message-flag
691 (apply 'format fmt args) 691 (apply #'format-message fmt args)
692 (if dframe-attached-frame 692 (if dframe-attached-frame
693 ;; KB: Here we do not need calling `dframe-select-attached-frame' 693 ;; KB: Here we do not need calling `dframe-select-attached-frame'
694 (select-frame dframe-attached-frame)) 694 (select-frame dframe-attached-frame))
695 (apply 'message fmt args)))) 695 (apply #'message fmt args))))
696 696
697(defun dframe-y-or-n-p (prompt) 697(defun dframe-y-or-n-p (prompt)
698 "Like `y-or-n-p', but for use in a dedicated frame. 698 "Like `y-or-n-p', but for use in a dedicated frame.
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 18a3c887aad..63ee75f1ff0 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1006,7 +1006,7 @@ return t; if SYM is q or ESC, return nil."
1006 nil) ; skip, and don't ask again 1006 nil) ; skip, and don't ask again
1007 (t ; no previous answer - ask now 1007 (t ; no previous answer - ask now
1008 (setq prompt 1008 (setq prompt
1009 (concat (apply 'format prompt args) 1009 (concat (apply #'format-message prompt args)
1010 (if help-form 1010 (if help-form
1011 (format " [Type yn!q or %s] " 1011 (format " [Type yn!q or %s] "
1012 (key-description (vector help-char))) 1012 (key-description (vector help-char)))
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 490d9a8b52c..716e1c69c7b 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -192,7 +192,7 @@
192 ;; (if (aref byte-code-vector 0) 192 ;; (if (aref byte-code-vector 0)
193 ;; (error "The old version of the disassembler is loaded. Reload new-bytecomp as well")) 193 ;; (error "The old version of the disassembler is loaded. Reload new-bytecomp as well"))
194 (byte-compile-log-1 194 (byte-compile-log-1
195 (apply 'format format 195 (apply #'format-message format
196 (let (c a) 196 (let (c a)
197 (mapcar (lambda (arg) 197 (mapcar (lambda (arg)
198 (if (not (consp arg)) 198 (if (not (consp arg))
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 0ae7824de1e..2ac926f1879 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -973,7 +973,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
973 (print-level 4) 973 (print-level 4)
974 (print-length 4)) 974 (print-length 4))
975 (byte-compile-log-1 975 (byte-compile-log-1
976 (format 976 (format-message
977 ,format-string 977 ,format-string
978 ,@(mapcar 978 ,@(mapcar
979 (lambda (x) (if (symbolp x) (list 'prin1-to-string x) x)) 979 (lambda (x) (if (symbolp x) (list 'prin1-to-string x) x))
@@ -1120,7 +1120,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1120 pt) 1120 pt)
1121 (when dir 1121 (when dir
1122 (unless was-same 1122 (unless was-same
1123 (insert (format "Leaving directory ‘%s’\n" default-directory)))) 1123 (insert (format-message "Leaving directory ‘%s’\n"
1124 default-directory))))
1124 (unless (bolp) 1125 (unless (bolp)
1125 (insert "\n")) 1126 (insert "\n"))
1126 (setq pt (point-marker)) 1127 (setq pt (point-marker))
@@ -1135,8 +1136,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1135 (when dir 1136 (when dir
1136 (setq default-directory dir) 1137 (setq default-directory dir)
1137 (unless was-same 1138 (unless was-same
1138 (insert (format "Entering directory ‘%s’\n" 1139 (insert (format-message "Entering directory ‘%s’\n"
1139 default-directory)))) 1140 default-directory))))
1140 (setq byte-compile-last-logged-file byte-compile-current-file 1141 (setq byte-compile-last-logged-file byte-compile-current-file
1141 byte-compile-last-warned-form nil) 1142 byte-compile-last-warned-form nil)
1142 ;; Do this after setting default-directory. 1143 ;; Do this after setting default-directory.
@@ -1154,7 +1155,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1154 1155
1155(defun byte-compile-warn (format &rest args) 1156(defun byte-compile-warn (format &rest args)
1156 "Issue a byte compiler warning; use (format FORMAT ARGS...) for message." 1157 "Issue a byte compiler warning; use (format FORMAT ARGS...) for message."
1157 (setq format (apply 'format format args)) 1158 (setq format (apply #'format-message format args))
1158 (if byte-compile-error-on-warn 1159 (if byte-compile-error-on-warn
1159 (error "%s" format) ; byte-compile-file catches and logs it 1160 (error "%s" format) ; byte-compile-file catches and logs it
1160 (byte-compile-log-warning format t :warning))) 1161 (byte-compile-log-warning format t :warning)))
@@ -2979,7 +2980,7 @@ for symbols generated by the byte compiler itself."
2979 (`(',var . ,_) 2980 (`(',var . ,_)
2980 (when (assq var byte-compile-lexical-variables) 2981 (when (assq var byte-compile-lexical-variables)
2981 (byte-compile-log-warning 2982 (byte-compile-log-warning
2982 (format "%s cannot use lexical var ‘%s’" fn var) 2983 (format-message "%s cannot use lexical var ‘%s’" fn var)
2983 nil :error))))) 2984 nil :error)))))
2984 (when (macroexp--const-symbol-p fn) 2985 (when (macroexp--const-symbol-p fn)
2985 (byte-compile-warn "‘%s’ called as a function" fn)) 2986 (byte-compile-warn "‘%s’ called as a function" fn))
@@ -2991,8 +2992,8 @@ for symbols generated by the byte compiler itself."
2991 (format "; %s" interactive-only)) 2992 (format "; %s" interactive-only))
2992 ((and (symbolp 'interactive-only) 2993 ((and (symbolp 'interactive-only)
2993 (not (eq interactive-only t))) 2994 (not (eq interactive-only t)))
2994 (format "; use ‘%s’ instead." 2995 (format-message "; use ‘%s’ instead."
2995 interactive-only)) 2996 interactive-only))
2996 (t ".")))) 2997 (t "."))))
2997 (if (eq (car-safe (symbol-function (car form))) 'macro) 2998 (if (eq (car-safe (symbol-function (car form))) 'macro)
2998 (byte-compile-log-warning 2999 (byte-compile-log-warning
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index ac5144c4be0..a20e201add6 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -300,7 +300,8 @@ places where they originally did not directly appear."
300 (prog1 binder (setq binder (list binder))) 300 (prog1 binder (setq binder (list binder)))
301 (when (cddr binder) 301 (when (cddr binder)
302 (byte-compile-log-warning 302 (byte-compile-log-warning
303 (format "Malformed ‘%S’ binding: %S" letsym binder))) 303 (format-message "Malformed ‘%S’ binding: %S"
304 letsym binder)))
304 (setq value (cadr binder)) 305 (setq value (cadr binder))
305 (car binder))) 306 (car binder)))
306 (new-val 307 (new-val
@@ -545,7 +546,7 @@ FORM is the parent form that binds this var."
545 (`((,(and var (guard (eq ?_ (aref (symbol-name var) 0)))) . ,_) 546 (`((,(and var (guard (eq ?_ (aref (symbol-name var) 0)))) . ,_)
546 ,_ ,_ ,_ ,_) 547 ,_ ,_ ,_ ,_)
547 (byte-compile-log-warning 548 (byte-compile-log-warning
548 (format "%s ‘%S’ not left unused" varkind var)))) 549 (format-message "%s ‘%S’ not left unused" varkind var))))
549 (pcase vardata 550 (pcase vardata
550 (`((,var . ,_) nil ,_ ,_ nil) 551 (`((,var . ,_) nil ,_ ,_ nil)
551 ;; FIXME: This gives warnings in the wrong order, with imprecise line 552 ;; FIXME: This gives warnings in the wrong order, with imprecise line
@@ -557,8 +558,8 @@ FORM is the parent form that binds this var."
557 (eq ?_ (aref (symbol-name var) 0)) 558 (eq ?_ (aref (symbol-name var) 0))
558 ;; As a special exception, ignore "ignore". 559 ;; As a special exception, ignore "ignore".
559 (eq var 'ignored)) 560 (eq var 'ignored))
560 (byte-compile-log-warning (format "Unused lexical %s ‘%S’" 561 (byte-compile-log-warning (format-message "Unused lexical %s ‘%S’"
561 varkind var)))) 562 varkind var))))
562 ;; If it's unused, there's no point converting it into a cons-cell, even if 563 ;; If it's unused, there's no point converting it into a cons-cell, even if
563 ;; it's captured and mutated. 564 ;; it's captured and mutated.
564 (`(,binder ,_ t t ,_) 565 (`(,binder ,_ t t ,_)
@@ -678,7 +679,7 @@ and updates the data stored in ENV."
678 679
679 ;; ((and `(quote ,v . ,_) (guard (assq v env))) 680 ;; ((and `(quote ,v . ,_) (guard (assq v env)))
680 ;; (byte-compile-log-warning 681 ;; (byte-compile-log-warning
681 ;; (format "Possible confusion variable/symbol for ‘%S’" v))) 682 ;; (format-message "Possible confusion variable/symbol for ‘%S’" v)))
682 683
683 (`(quote . ,_) nil) ; quote form 684 (`(quote . ,_) nil) ; quote form
684 (`(function . ,_) nil) ; same as quote 685 (`(function . ,_) nil) ; same as quote
diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el
index 2c2f68482a9..bdcb4ec00a2 100644
--- a/lisp/emacs-lisp/check-declare.el
+++ b/lisp/emacs-lisp/check-declare.el
@@ -279,8 +279,8 @@ TYPE is a string giving the nature of the error. Warning is displayed in
279 entry)) 279 entry))
280 (warning-fill-prefix " ")) 280 (warning-fill-prefix " "))
281 (display-warning 'check-declare 281 (display-warning 'check-declare
282 (format "said ‘%s’ was defined in %s: %s" 282 (format-message "said ‘%s’ was defined in %s: %s"
283 fn (file-name-nondirectory fnfile) type) 283 fn (file-name-nondirectory fnfile) type)
284 nil check-declare-warning-buffer))) 284 nil check-declare-warning-buffer)))
285 285
286(declare-function compilation-forget-errors "compile" ()) 286(declare-function compilation-forget-errors "compile" ())
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 14c2a1b872e..ebe21d06b8d 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1714,7 +1714,7 @@ function,command,variable,option or symbol." ms1))))))
1714 e t)) 1714 e t))
1715 (if (checkdoc-autofix-ask-replace 1715 (if (checkdoc-autofix-ask-replace
1716 (match-beginning 1) (match-end 1) 1716 (match-beginning 1) (match-end 1)
1717 (format 1717 (format-message
1718 "If this is the argument ‘%s’, it should appear as %s. Fix? " 1718 "If this is the argument ‘%s’, it should appear as %s. Fix? "
1719 (car args) (upcase (car args))) 1719 (car args) (upcase (car args)))
1720 (upcase (car args)) t) 1720 (upcase (car args)) t)
@@ -1740,7 +1740,7 @@ function,command,variable,option or symbol." ms1))))))
1740 (insert ".")) 1740 (insert "."))
1741 nil) 1741 nil)
1742 (checkdoc-create-error 1742 (checkdoc-create-error
1743 (format 1743 (format-message
1744 "Argument ‘%s’ should appear (as %s) in the doc string" 1744 "Argument ‘%s’ should appear (as %s) in the doc string"
1745 (car args) (upcase (car args))) 1745 (car args) (upcase (car args)))
1746 s (marker-position e))) 1746 s (marker-position e)))
@@ -1824,16 +1824,16 @@ Replace with \"%s\"? " original replace)
1824 (setq found (intern-soft ms)) 1824 (setq found (intern-soft ms))
1825 (or (boundp found) (fboundp found))) 1825 (or (boundp found) (fboundp found)))
1826 (progn 1826 (progn
1827 (setq msg (format "Add quotes around Lisp symbol ‘%s’? " 1827 (setq msg (format-message
1828 ms)) 1828 "Add quotes around Lisp symbol ‘%s’? " ms))
1829 (if (checkdoc-autofix-ask-replace 1829 (if (checkdoc-autofix-ask-replace
1830 (match-beginning 1) (+ (match-beginning 1) 1830 (match-beginning 1) (+ (match-beginning 1)
1831 (length ms)) 1831 (length ms))
1832 msg (concat "‘" ms "’") t) 1832 msg (concat "‘" ms "’") t)
1833 (setq msg nil) 1833 (setq msg nil)
1834 (setq msg 1834 (setq msg
1835 (format "Lisp symbol ‘%sshould appear in quotes" 1835 (format-message
1836 ms)))))) 1836 "Lisp symbol ‘%s’ should appear in quotes" ms))))))
1837 (if msg 1837 (if msg
1838 (checkdoc-create-error msg (match-beginning 1) 1838 (checkdoc-create-error msg (match-beginning 1)
1839 (+ (match-beginning 1) 1839 (+ (match-beginning 1)
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index ea77c92737d..06e75b36670 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2101,8 +2101,8 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
2101 macroexpand-all-environment)))) 2101 macroexpand-all-environment))))
2102 (if (or (null (cdar bindings)) (cl-cddar bindings)) 2102 (if (or (null (cdar bindings)) (cl-cddar bindings))
2103 (macroexp--warn-and-return 2103 (macroexp--warn-and-return
2104 (format "Malformed ‘cl-symbol-macrolet’ binding: %S" 2104 (format-message "Malformed ‘cl-symbol-macrolet’ binding: %S"
2105 (car bindings)) 2105 (car bindings))
2106 expansion) 2106 expansion)
2107 expansion))) 2107 expansion)))
2108 (fset 'macroexpand previous-macroexpand)))))) 2108 (fset 'macroexpand previous-macroexpand))))))
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index d7e390359a8..7cc789f7129 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -3373,7 +3373,7 @@ Return the result of the last expression."
3373(defalias 'edebug-prin1 'prin1) 3373(defalias 'edebug-prin1 'prin1)
3374(defalias 'edebug-print 'print) 3374(defalias 'edebug-print 'print)
3375(defalias 'edebug-prin1-to-string 'prin1-to-string) 3375(defalias 'edebug-prin1-to-string 'prin1-to-string)
3376(defalias 'edebug-format 'format) 3376(defalias 'edebug-format 'format-message)
3377(defalias 'edebug-message 'message) 3377(defalias 'edebug-message 'message)
3378 3378
3379(defun edebug-eval-expression (expr) 3379(defun edebug-eval-expression (expr)
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index 2ecf4129008..3b07c5dec4b 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -733,7 +733,7 @@ Argument FN is the function calling this verifier."
733 ((and (or `',name (and name (pred keywordp))) 733 ((and (or `',name (and name (pred keywordp)))
734 (guard (not (memq name eieio--known-slot-names)))) 734 (guard (not (memq name eieio--known-slot-names))))
735 (macroexp--warn-and-return 735 (macroexp--warn-and-return
736 (format "Unknown slot ‘%S’" name) exp 'compile-only)) 736 (format-message "Unknown slot ‘%S’" name) exp 'compile-only))
737 (_ exp))))) 737 (_ exp)))))
738 (cl-check-type slot symbol) 738 (cl-check-type slot symbol)
739 (cl-check-type obj (or eieio-object class)) 739 (cl-check-type obj (or eieio-object class))
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 032cdec066d..feffd5470c4 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -261,7 +261,7 @@ Otherwise work like `message'."
261 mode-line-format))) 261 mode-line-format)))
262 (setq eldoc-mode-line-string 262 (setq eldoc-mode-line-string
263 (when (stringp format-string) 263 (when (stringp format-string)
264 (apply 'format format-string args))) 264 (apply #'format-message format-string args)))
265 (force-mode-line-update))) 265 (force-mode-line-update)))
266 (apply 'message format-string args))) 266 (apply 'message format-string args)))
267 267
@@ -274,7 +274,7 @@ Otherwise work like `message'."
274 ;; eldoc-last-message so eq test above might succeed on 274 ;; eldoc-last-message so eq test above might succeed on
275 ;; subsequent calls. 275 ;; subsequent calls.
276 ((null (cdr args)) (car args)) 276 ((null (cdr args)) (car args))
277 (t (apply 'format args)))) 277 (t (apply #'format-message args))))
278 ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages 278 ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages
279 ;; are recorded in a log. Do not put eldoc messages in that log since 279 ;; are recorded in a log. Do not put eldoc messages in that log since
280 ;; they are Legion. 280 ;; they are Legion.
diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el
index 3365a852570..8c67d8cd791 100644
--- a/lisp/emacs-lisp/elint.el
+++ b/lisp/emacs-lisp/elint.el
@@ -249,9 +249,9 @@ This environment can be passed to `macroexpand'."
249 (elint-set-mode-line t) 249 (elint-set-mode-line t)
250 (with-current-buffer elint-log-buffer 250 (with-current-buffer elint-log-buffer
251 (unless (string-equal default-directory dir) 251 (unless (string-equal default-directory dir)
252 (elint-log-message (format " \nLeaving directory ‘%s’" 252 (elint-log-message (format-message " \nLeaving directory ‘%s’"
253 default-directory) t) 253 default-directory) t)
254 (elint-log-message (format "Entering directory ‘%s’" dir) t) 254 (elint-log-message (format-message "Entering directory ‘%s’" dir) t)
255 (setq default-directory dir)))) 255 (setq default-directory dir))))
256 (let ((str (format "Linting file %s" file))) 256 (let ((str (format "Linting file %s" file)))
257 (message "%s..." str) 257 (message "%s..." str)
@@ -982,7 +982,7 @@ Does basic handling of `featurep' tests."
982 (line-beginning-position)))) 982 (line-beginning-position))))
983 0) ; unknown position 983 0) ; unknown position
984 type 984 type
985 (apply 'format string args)))) 985 (apply #'format-message string args))))
986 986
987(defun elint-error (string &rest args) 987(defun elint-error (string &rest args)
988 "Report a linting error. 988 "Report a linting error.
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 3b103e09bca..86a1f283238 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -367,10 +367,11 @@ message about the whole chain of aliases."
367 (not verbose) 367 (not verbose)
368 (setq aliases (if aliases 368 (setq aliases (if aliases
369 (concat aliases 369 (concat aliases
370 (format ", which is an alias for ‘%s’" 370 (format-message
371 (symbol-name def))) 371 ", which is an alias for ‘%s’"
372 (format "‘%s’ is an alias for ‘%s’" 372 (symbol-name def)))
373 function (symbol-name def))))) 373 (format-message "‘%s’ is an alias for ‘%s’"
374 function (symbol-name def)))))
374 (setq function (find-function-advised-original function) 375 (setq function (find-function-advised-original function)
375 def (find-function-advised-original function))) 376 def (find-function-advised-original function)))
376 (if aliases 377 (if aliases
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index cc461c81cdd..ff359e6096e 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -146,11 +146,12 @@ and also to avoid outputting the warning during normal execution."
146(defun macroexp--obsolete-warning (fun obsolescence-data type) 146(defun macroexp--obsolete-warning (fun obsolescence-data type)
147 (let ((instead (car obsolescence-data)) 147 (let ((instead (car obsolescence-data))
148 (asof (nth 2 obsolescence-data))) 148 (asof (nth 2 obsolescence-data)))
149 (format "‘%s’ is an obsolete %s%s%s" fun type 149 (format-message
150 (if asof (concat " (as of " asof ")") "") 150 "‘%s’ is an obsolete %s%s%s" fun type
151 (cond ((stringp instead) (concat "; " instead)) 151 (if asof (concat " (as of " asof ")") "")
152 (instead (format "; use ‘%s’ instead." instead)) 152 (cond ((stringp instead) (concat "; " instead))
153 (t "."))))) 153 (instead (format-message "; use ‘%s’ instead." instead))
154 (t ".")))))
154 155
155(defun macroexpand-1 (form &optional environment) 156(defun macroexpand-1 (form &optional environment)
156 "Perform (at most) one step of macroexpansion." 157 "Perform (at most) one step of macroexpansion."
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index ceae99b4209..3ac7094990d 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -198,7 +198,8 @@ Returns the number of actions taken."
198 (objects (if help (nth 1 help) "objects")) 198 (objects (if help (nth 1 help) "objects"))
199 (action (if help (nth 2 help) "act on"))) 199 (action (if help (nth 2 help) "act on")))
200 (concat 200 (concat
201 (format "Type SPC or ‘y’ to %s the current %s; 201 (format-message "\
202Type SPC or ‘y’ to %s the current %s;
202DEL or ‘n’ to skip the current %s; 203DEL or ‘n’ to skip the current %s;
203RET or ‘q’ to give up on the %s (skip all remaining %s); 204RET or ‘q’ to give up on the %s (skip all remaining %s);
204C-g to quit (cancel the whole command); 205C-g to quit (cancel the whole command);
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 4d5b0c78cc3..7eebb5ebaf8 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -95,7 +95,7 @@ Each element has the form (WHERE BYTECODE STACK) where:
95 (propertize (format "%s advice: " where) 95 (propertize (format "%s advice: " where)
96 'face 'warning) 96 'face 'warning)
97 (let ((fun (advice--car flist))) 97 (let ((fun (advice--car flist)))
98 (if (symbolp fun) (format "‘%S’" fun) 98 (if (symbolp fun) (format-message "‘%S’" fun)
99 (let* ((name (cdr (assq 'name (advice--props flist)))) 99 (let* ((name (cdr (assq 'name (advice--props flist))))
100 (doc (documentation fun t)) 100 (doc (documentation fun t))
101 (usage (help-split-fundoc doc function))) 101 (usage (help-split-fundoc doc function)))
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 3d2dbdf8712..7c4f21f603b 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1592,11 +1592,12 @@ SEEN is used internally to detect infinite recursion."
1592 (unless problem 1592 (unless problem
1593 (setq problem 1593 (setq problem
1594 (if (stringp disabled) 1594 (if (stringp disabled)
1595 (format "Package ‘%s’ held at version %s, but version %s required" 1595 (format-message
1596 next-pkg disabled 1596 "Package ‘%s’ held at version %s, but version %s required"
1597 (package-version-join next-version)) 1597 next-pkg disabled
1598 (format "Required package ‘%s’ is disabled" 1598 (package-version-join next-version))
1599 next-pkg))))) 1599 (format-message "Required package ‘%s’ is disabled"
1600 next-pkg)))))
1600 (t (setq found pkg-desc))))) 1601 (t (setq found pkg-desc)))))
1601 (unless found 1602 (unless found
1602 (cond 1603 (cond
@@ -2365,16 +2366,16 @@ Otherwise no newline is inserted."
2365 2366
2366(defun package-install-button-action (button) 2367(defun package-install-button-action (button)
2367 (let ((pkg-desc (button-get button 'package-desc))) 2368 (let ((pkg-desc (button-get button 'package-desc)))
2368 (when (y-or-n-p (format "Install package ‘%s’? " 2369 (when (y-or-n-p (format-message "Install package ‘%s’? "
2369 (package-desc-full-name pkg-desc))) 2370 (package-desc-full-name pkg-desc)))
2370 (package-install pkg-desc nil) 2371 (package-install pkg-desc nil)
2371 (revert-buffer nil t) 2372 (revert-buffer nil t)
2372 (goto-char (point-min))))) 2373 (goto-char (point-min)))))
2373 2374
2374(defun package-delete-button-action (button) 2375(defun package-delete-button-action (button)
2375 (let ((pkg-desc (button-get button 'package-desc))) 2376 (let ((pkg-desc (button-get button 'package-desc)))
2376 (when (y-or-n-p (format "Delete package ‘%s’? " 2377 (when (y-or-n-p (format-message "Delete package ‘%s’? "
2377 (package-desc-full-name pkg-desc))) 2378 (package-desc-full-name pkg-desc)))
2378 (package-delete pkg-desc) 2379 (package-delete pkg-desc)
2379 (revert-buffer nil t) 2380 (revert-buffer nil t)
2380 (goto-char (point-min))))) 2381 (goto-char (point-min)))))
@@ -3077,8 +3078,8 @@ prompt (see `package-menu--prompt-transaction-p')."
3077 (length packages) 3078 (length packages)
3078 (mapconcat #'package-desc-full-name packages ", "))) 3079 (mapconcat #'package-desc-full-name packages ", ")))
3079 ;; Exactly 1 3080 ;; Exactly 1
3080 (t (format "package ‘%s’" 3081 (t (format-message "package ‘%s’"
3081 (package-desc-full-name (car packages)))))) 3082 (package-desc-full-name (car packages))))))
3082 3083
3083(defun package-menu--prompt-transaction-p (delete install upgrade) 3084(defun package-menu--prompt-transaction-p (delete install upgrade)
3084 "Prompt the user about DELETE, INSTALL, and UPGRADE. 3085 "Prompt the user about DELETE, INSTALL, and UPGRADE.
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index dadbe5f7b67..0a0296fc9fb 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -324,7 +324,8 @@ This function is called, by name, directly by the C code."
324 (apply (timer--function timer) (timer--args timer))) 324 (apply (timer--function timer) (timer--args timer)))
325 (error (message "Error running timer%s: %S" 325 (error (message "Error running timer%s: %S"
326 (if (symbolp (timer--function timer)) 326 (if (symbolp (timer--function timer))
327 (format " ‘%s’" (timer--function timer)) "") 327 (format-message " ‘%s’" (timer--function timer))
328 "")
328 err))) 329 err)))
329 (when (and retrigger 330 (when (and retrigger
330 ;; If the timer's been canceled, don't "retrigger" it 331 ;; If the timer's been canceled, don't "retrigger" it
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 44a9876a078..d729a9a9563 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -316,7 +316,7 @@ See also `warning-series', `warning-prefix-function' and
316(defun lwarn (type level message &rest args) 316(defun lwarn (type level message &rest args)
317 "Display a warning message made from (format MESSAGE ARGS...). 317 "Display a warning message made from (format MESSAGE ARGS...).
318\\<special-mode-map> 318\\<special-mode-map>
319Aside from generating the message with `format', 319Aside from generating the message with `format-message',
320this is equivalent to `display-warning'. 320this is equivalent to `display-warning'.
321 321
322TYPE is the warning type: either a custom group name (a symbol), 322TYPE is the warning type: either a custom group name (a symbol),
@@ -332,15 +332,15 @@ LEVEL should be either :debug, :warning, :error, or :emergency
332:error -- invalid data or circumstances. 332:error -- invalid data or circumstances.
333:warning -- suspicious data or circumstances. 333:warning -- suspicious data or circumstances.
334:debug -- info for debugging only." 334:debug -- info for debugging only."
335 (display-warning type (apply 'format message args) level)) 335 (display-warning type (apply #'format-message message args) level))
336 336
337;;;###autoload 337;;;###autoload
338(defun warn (message &rest args) 338(defun warn (message &rest args)
339 "Display a warning message made from (format MESSAGE ARGS...). 339 "Display a warning message made from (format MESSAGE ARGS...).
340Aside from generating the message with `format', 340Aside from generating the message with `format-message',
341this is equivalent to `display-warning', using 341this is equivalent to `display-warning', using
342`emacs' as the type and `:warning' as the level." 342`emacs' as the type and `:warning' as the level."
343 (display-warning 'emacs (apply 'format message args))) 343 (display-warning 'emacs (apply #'format-message message args)))
344 344
345(provide 'warnings) 345(provide 'warnings)
346 346
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 40a37c7d8b6..14f424e9344 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -3447,8 +3447,8 @@ controlled by the sign of prefix numeric value."
3447 (interactive) 3447 (interactive)
3448 (setq viper-parse-sexp-ignore-comments 3448 (setq viper-parse-sexp-ignore-comments
3449 (not viper-parse-sexp-ignore-comments)) 3449 (not viper-parse-sexp-ignore-comments))
3450 (princ (format 3450 (princ (format-message
3451 "From now on, `%%' will %signore parentheses inside comment fields" 3451 "From now on, %% will %signore parentheses inside comment fields"
3452 (if viper-parse-sexp-ignore-comments "" "NOT ")))) 3452 (if viper-parse-sexp-ignore-comments "" "NOT "))))
3453 3453
3454 3454
@@ -3986,8 +3986,8 @@ Null string will repeat previous search."
3986 (if (null buffer) (error "`%s': No such buffer" buffer-name)) 3986 (if (null buffer) (error "`%s': No such buffer" buffer-name))
3987 (if (or (not (buffer-modified-p buffer)) 3987 (if (or (not (buffer-modified-p buffer))
3988 (y-or-n-p 3988 (y-or-n-p
3989 (format 3989 (format-message
3990 "Buffer `%s' is modified, are you sure you want to kill it? " 3990 "Buffer %s is modified, are you sure you want to kill it? "
3991 buffer-name))) 3991 buffer-name)))
3992 (kill-buffer buffer) 3992 (kill-buffer buffer)
3993 (error "Buffer not killed")))) 3993 (error "Buffer not killed"))))
@@ -4636,8 +4636,8 @@ One can use \\=`\\=` and '' to temporarily jump 1 step back."
4636 (substring text 0 (- pos s)) 4636 (substring text 0 (- pos s))
4637 reg (substring text (- pos s))))) 4637 reg (substring text (- pos s)))))
4638 (princ 4638 (princ
4639 (format 4639 (format-message
4640 "Textmarker `%c' is in buffer `%s' at line %d.\n" 4640 "Textmarker %c is in buffer %s at line %d.\n"
4641 reg (buffer-name buf) line-no)) 4641 reg (buffer-name buf) line-no))
4642 (princ (format "Here is some text around %c:\n\n %s" 4642 (princ (format "Here is some text around %c:\n\n %s"
4643 reg text))) 4643 reg text)))
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index 89bc77f9799..e8568328b7a 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -369,12 +369,12 @@ If SCOPE is nil, the user is asked to specify the scope."
369 (setq scope 369 (setq scope
370 (cond 370 (cond
371 ((y-or-n-p 371 ((y-or-n-p
372 (format 372 (format-message
373 "Map this macro for buffer `%s' only? " 373 "Map this macro for buffer %s only? "
374 (buffer-name))) 374 (buffer-name)))
375 (setq msg 375 (setq msg
376 (format 376 (format-message
377 "%S is mapped to %s for %s in `%s'" 377 "%S is mapped to %s for %s in %s"
378 (viper-display-macro macro-name) 378 (viper-display-macro macro-name)
379 (viper-abbreviate-string 379 (viper-abbreviate-string
380 (format 380 (format
@@ -385,12 +385,12 @@ If SCOPE is nil, the user is asked to specify the scope."
385 state-name (buffer-name))) 385 state-name (buffer-name)))
386 (buffer-name)) 386 (buffer-name))
387 ((y-or-n-p 387 ((y-or-n-p
388 (format 388 (format-message
389 "Map this macro for the major mode `%S' only? " 389 "Map this macro for the major mode %S only? "
390 major-mode)) 390 major-mode))
391 (setq msg 391 (setq msg
392 (format 392 (format-message
393 "%S is mapped to %s for %s in `%S'" 393 "%S is mapped to %s for %s in %S"
394 (viper-display-macro macro-name) 394 (viper-display-macro macro-name)
395 (viper-abbreviate-string 395 (viper-abbreviate-string
396 (format 396 (format
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 6c847f062e4..a90794f6c7b 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -797,7 +797,7 @@ This is called whenever you create a new face, and at other times."
797 symbol (intern name))) 797 symbol (intern name)))
798 (setq menu 'facemenu-face-menu) 798 (setq menu 'facemenu-face-menu)
799 (setq docstring 799 (setq docstring
800 (purecopy (format "Select face ‘%s’ for subsequent insertion. 800 (purecopy (format-message "Select face ‘%s’ for subsequent insertion.
801If the mark is active and there is no prefix argument, 801If the mark is active and there is no prefix argument,
802apply face ‘%s’ to the region instead. 802apply face ‘%s’ to the region instead.
803This command was defined by ‘facemenu-add-new-face’." 803This command was defined by ‘facemenu-add-new-face’."
diff --git a/lisp/faces.el b/lisp/faces.el
index e628ee7870b..9e879c1e188 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -574,7 +574,7 @@ If FACE is a face-alias, get the documentation for the target face."
574 (let ((alias (get face 'face-alias))) 574 (let ((alias (get face 'face-alias)))
575 (if alias 575 (if alias
576 (let ((doc (get alias 'face-documentation))) 576 (let ((doc (get alias 'face-documentation)))
577 (format "%s is an alias for the face ‘%s’.%s" face alias 577 (format-message "%s is an alias for the face ‘%s’.%s" face alias
578 (if doc (format "\n%s" doc) 578 (if doc (format "\n%s" doc)
579 ""))) 579 "")))
580 (get face 'face-documentation)))) 580 (get face 'face-documentation))))
@@ -1005,7 +1005,7 @@ a single face name."
1005 (setq default (car (split-string default crm-separator t)))) 1005 (setq default (car (split-string default crm-separator t))))
1006 1006
1007 (let ((prompt (if default 1007 (let ((prompt (if default
1008 (format "%s (default ‘%s’): " prompt default) 1008 (format-message "%s (default ‘%s’): " prompt default)
1009 (format "%s: " prompt))) 1009 (format "%s: " prompt)))
1010 aliasfaces nonaliasfaces faces) 1010 aliasfaces nonaliasfaces faces)
1011 ;; Build up the completion tables. 1011 ;; Build up the completion tables.
@@ -1136,10 +1136,10 @@ Value is the new attribute value."
1136 (setq name (concat (upcase (substring name 0 1)) (substring name 1))) 1136 (setq name (concat (upcase (substring name 0 1)) (substring name 1)))
1137 (let* ((completion-ignore-case t) 1137 (let* ((completion-ignore-case t)
1138 (value (completing-read 1138 (value (completing-read
1139 (if default 1139 (format-message (if default
1140 (format "%s for face ‘%s’ (default %s): " 1140 "%s for face ‘%s’ (default %s): "
1141 name face default) 1141 "%s for face ‘%s’: ")
1142 (format "%s for face ‘%s’: " name face)) 1142 name face default)
1143 completion-alist nil nil nil nil default))) 1143 completion-alist nil nil nil nil default)))
1144 (if (equal value "") default value))) 1144 (if (equal value "") default value)))
1145 1145
@@ -1224,8 +1224,8 @@ of a global face. Value is the new attribute value."
1224 "Read the name of a font for FACE on FRAME. 1224 "Read the name of a font for FACE on FRAME.
1225If optional argument FRAME is nil or omitted, use the selected frame." 1225If optional argument FRAME is nil or omitted, use the selected frame."
1226 (let ((completion-ignore-case t)) 1226 (let ((completion-ignore-case t))
1227 (completing-read (format "Set font attributes of face ‘%s’ from font: " 1227 (completing-read (format-message
1228 face) 1228 "Set font attributes of face ‘%s’ from font: " face)
1229 (append (fontset-list) (x-list-fonts "*" nil frame))))) 1229 (append (fontset-list) (x-list-fonts "*" nil frame)))))
1230 1230
1231 1231
@@ -1436,17 +1436,17 @@ If FRAME is omitted or nil, use the selected frame."
1436 (when alias 1436 (when alias
1437 (setq face alias) 1437 (setq face alias)
1438 (insert 1438 (insert
1439 (format (substitute-command-keys 1439 (format-message
1440 "\n %s is an alias for the face ‘%s’.\n%s") 1440 "\n %s is an alias for the face ‘%s’.\n%s"
1441 f alias 1441 f alias
1442 (if (setq obsolete (get f 'obsolete-face)) 1442 (if (setq obsolete (get f 'obsolete-face))
1443 (format (substitute-command-keys 1443 (format-message
1444 " This face is obsolete%s; use ‘%s’ instead.\n") 1444 " This face is obsolete%s; use ‘%s’ instead.\n"
1445 (if (stringp obsolete) 1445 (if (stringp obsolete)
1446 (format " since %s" obsolete) 1446 (format " since %s" obsolete)
1447 "") 1447 "")
1448 alias) 1448 alias)
1449 "")))) 1449 ""))))
1450 (insert "\nDocumentation:\n" 1450 (insert "\nDocumentation:\n"
1451 (substitute-command-keys 1451 (substitute-command-keys
1452 (or (face-documentation face) 1452 (or (face-documentation face)
diff --git a/lisp/files.el b/lisp/files.el
index 10392677c67..f96ac09f5e6 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1641,8 +1641,8 @@ killed."
1641 (user-error "Aborted")) 1641 (user-error "Aborted"))
1642 (and (buffer-modified-p) buffer-file-name 1642 (and (buffer-modified-p) buffer-file-name
1643 (not (yes-or-no-p 1643 (not (yes-or-no-p
1644 (format "Kill and replace buffer ‘%s’ without saving it? " 1644 (format-message "Kill and replace buffer ‘%s’ without saving it? "
1645 (buffer-name)))) 1645 (buffer-name))))
1646 (user-error "Aborted")) 1646 (user-error "Aborted"))
1647 (let ((obuf (current-buffer)) 1647 (let ((obuf (current-buffer))
1648 (ofile buffer-file-name) 1648 (ofile buffer-file-name)
@@ -3419,9 +3419,10 @@ local variables, but directory-local variables may still be applied."
3419 (setq hack-local-variables--warned-lexical t) 3419 (setq hack-local-variables--warned-lexical t)
3420 (display-warning 3420 (display-warning
3421 :warning 3421 :warning
3422 (format "%s: ‘lexical-binding’ at end of file unreliable" 3422 (format-message
3423 (file-name-nondirectory 3423 "%s: ‘lexical-binding’ at end of file unreliable"
3424 (or buffer-file-name "")))))) 3424 (file-name-nondirectory
3425 (or buffer-file-name ""))))))
3425 (t 3426 (t
3426 (ignore-errors 3427 (ignore-errors
3427 (push (cons (if (eq var 'eval) 3428 (push (cons (if (eq var 'eval)
@@ -3556,7 +3557,7 @@ It is dangerous if either of these conditions are met:
3556 var (if since (format " (since %s)" since)) 3557 var (if since (format " (since %s)" since))
3557 (if (stringp instead) 3558 (if (stringp instead)
3558 (substitute-command-keys instead) 3559 (substitute-command-keys instead)
3559 (format "use ‘%s’ instead" instead))))))) 3560 (format-message "use ‘%s’ instead" instead)))))))
3560 3561
3561(defun hack-one-local-variable (var val) 3562(defun hack-one-local-variable (var val)
3562 "Set local variable VAR with value VAL. 3563 "Set local variable VAR with value VAL.
@@ -4028,7 +4029,8 @@ Interactively, confirmation is required unless you supply a prefix argument."
4028 (not (and (eq (framep-on-display) 'ns) 4029 (not (and (eq (framep-on-display) 'ns)
4029 (listp last-nonmenu-event) 4030 (listp last-nonmenu-event)
4030 use-dialog-box)) 4031 use-dialog-box))
4031 (or (y-or-n-p (format "File ‘%s’ exists; overwrite? " filename)) 4032 (or (y-or-n-p (format-message
4033 "File ‘%s’ exists; overwrite? " filename))
4032 (user-error "Canceled"))) 4034 (user-error "Canceled")))
4033 (set-visited-file-name filename (not confirm)))) 4035 (set-visited-file-name filename (not confirm))))
4034 (set-buffer-modified-p t) 4036 (set-buffer-modified-p t)
@@ -4733,8 +4735,9 @@ Before and after saving the buffer, this function runs
4733 ;; Signal an error if the user specified the name of an 4735 ;; Signal an error if the user specified the name of an
4734 ;; existing directory. 4736 ;; existing directory.
4735 (error "%s is a directory" filename) 4737 (error "%s is a directory" filename)
4736 (unless (y-or-n-p (format "File ‘%s’ exists; overwrite? " 4738 (unless (y-or-n-p (format-message
4737 filename)) 4739 "File ‘%s’ exists; overwrite? "
4740 filename))
4738 (error "Canceled")))) 4741 (error "Canceled"))))
4739 (set-visited-file-name filename))) 4742 (set-visited-file-name filename)))
4740 (or (verify-visited-file-modtime (current-buffer)) 4743 (or (verify-visited-file-modtime (current-buffer))
@@ -4774,7 +4777,8 @@ Before and after saving the buffer, this function runs
4774 (expand-file-name buffer-file-name)))) 4777 (expand-file-name buffer-file-name))))
4775 (unless (file-exists-p dir) 4778 (unless (file-exists-p dir)
4776 (if (y-or-n-p 4779 (if (y-or-n-p
4777 (format "Directory ‘%s’ does not exist; create? " dir)) 4780 (format-message
4781 "Directory ‘%s’ does not exist; create? " dir))
4778 (make-directory dir t) 4782 (make-directory dir t)
4779 (error "Canceled"))) 4783 (error "Canceled")))
4780 (setq setmodes (basic-save-buffer-1)))) 4784 (setq setmodes (basic-save-buffer-1))))
@@ -5217,8 +5221,8 @@ given. With a prefix argument, TRASH is nil."
5217 (list dir 5221 (list dir
5218 (if (directory-files dir nil directory-files-no-dot-files-regexp) 5222 (if (directory-files dir nil directory-files-no-dot-files-regexp)
5219 (y-or-n-p 5223 (y-or-n-p
5220 (format "Directory ‘%s’ is not empty, really %s? " 5224 (format-message "Directory ‘%s’ is not empty, really %s? "
5221 dir (if trashing "trash" "delete"))) 5225 dir (if trashing "trash" "delete")))
5222 nil) 5226 nil)
5223 (null current-prefix-arg)))) 5227 (null current-prefix-arg))))
5224 ;; If default-directory is a remote directory, make sure we find its 5228 ;; If default-directory is a remote directory, make sure we find its
diff --git a/lisp/format.el b/lisp/format.el
index afec51c3aa2..7ab68c8a04e 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -395,8 +395,8 @@ unless you supply a prefix argument."
395 (cdr (assq 'default-directory 395 (cdr (assq 'default-directory
396 (buffer-local-variables))) 396 (buffer-local-variables)))
397 nil nil (buffer-name)))) 397 nil nil (buffer-name))))
398 (fmt (format-read (format "Write file ‘%s’ in format: " 398 (fmt (format-read (format-message "Write file ‘%s’ in format: "
399 (file-name-nondirectory file))))) 399 (file-name-nondirectory file)))))
400 (list file fmt (not current-prefix-arg)))) 400 (list file fmt (not current-prefix-arg))))
401 (let ((old-formats buffer-file-format) 401 (let ((old-formats buffer-file-format)
402 preserve-formats) 402 preserve-formats)
@@ -416,8 +416,8 @@ If FORMAT is nil then do not do any format conversion."
416 (interactive 416 (interactive
417 ;; Same interactive spec as write-file, plus format question. 417 ;; Same interactive spec as write-file, plus format question.
418 (let* ((file (read-file-name "Find file: ")) 418 (let* ((file (read-file-name "Find file: "))
419 (fmt (format-read (format "Read file ‘%s’ in format: " 419 (fmt (format-read (format-message "Read file ‘%s’ in format: "
420 (file-name-nondirectory file))))) 420 (file-name-nondirectory file)))))
421 (list file fmt))) 421 (list file fmt)))
422 (let ((format-alist nil)) 422 (let ((format-alist nil))
423 (find-file filename)) 423 (find-file filename))
@@ -435,8 +435,8 @@ a list (ABSOLUTE-FILE-NAME SIZE)."
435 (interactive 435 (interactive
436 ;; Same interactive spec as write-file, plus format question. 436 ;; Same interactive spec as write-file, plus format question.
437 (let* ((file (read-file-name "Find file: ")) 437 (let* ((file (read-file-name "Find file: "))
438 (fmt (format-read (format "Read file ‘%s’ in format: " 438 (fmt (format-read (format-message "Read file ‘%s’ in format: "
439 (file-name-nondirectory file))))) 439 (file-name-nondirectory file)))))
440 (list file fmt))) 440 (list file fmt)))
441 (let (value size old-undo) 441 (let (value size old-undo)
442 ;; Record only one undo entry for the insertion. Inhibit point-motion and 442 ;; Record only one undo entry for the insertion. Inhibit point-motion and
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index afd09ca6df5..6ff30b39d46 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -319,9 +319,7 @@ suitable file is found, return nil."
319 (when remapped 319 (when remapped
320 (princ "Its keys are remapped to ") 320 (princ "Its keys are remapped to ")
321 (princ (if (symbolp remapped) 321 (princ (if (symbolp remapped)
322 (concat (substitute-command-keys "‘") 322 (format-message "‘%s’" remapped)
323 (symbol-name remapped)
324 (substitute-command-keys "’"))
325 "an anonymous command")) 323 "an anonymous command"))
326 (princ ".\n")) 324 (princ ".\n"))
327 325
@@ -355,7 +353,7 @@ suitable file is found, return nil."
355 (insert "\nThis function has a compiler macro") 353 (insert "\nThis function has a compiler macro")
356 (if (symbolp handler) 354 (if (symbolp handler)
357 (progn 355 (progn
358 (insert (format (substitute-command-keys " ‘%s’") handler)) 356 (insert (format-message " ‘%s’" handler))
359 (save-excursion 357 (save-excursion
360 (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’") 358 (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’")
361 nil t) 359 nil t)
@@ -363,7 +361,7 @@ suitable file is found, return nil."
363 ;; FIXME: Obsolete since 24.4. 361 ;; FIXME: Obsolete since 24.4.
364 (let ((lib (get function 'compiler-macro-file))) 362 (let ((lib (get function 'compiler-macro-file)))
365 (when (stringp lib) 363 (when (stringp lib)
366 (insert (format (substitute-command-keys " in ‘%s’") lib)) 364 (insert (format-message " in ‘%s’" lib))
367 (save-excursion 365 (save-excursion
368 (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’") 366 (re-search-backward (substitute-command-keys "‘\\([^‘’]+\\)’")
369 nil t) 367 nil t)
@@ -443,9 +441,7 @@ suitable file is found, return nil."
443 (when (nth 2 obsolete) 441 (when (nth 2 obsolete)
444 (insert (format " since %s" (nth 2 obsolete)))) 442 (insert (format " since %s" (nth 2 obsolete))))
445 (insert (cond ((stringp use) (concat ";\n" use)) 443 (insert (cond ((stringp use) (concat ";\n" use))
446 (use (format (substitute-command-keys 444 (use (format-message ";\nuse ‘%s’ instead." use))
447 ";\nuse ‘%s’ instead.")
448 use))
449 (t ".")) 445 (t "."))
450 "\n")))) 446 "\n"))))
451 447
@@ -481,9 +477,8 @@ FILE is the file where FUNCTION was probably defined."
481 (format ";\nin Lisp code %s" interactive-only)) 477 (format ";\nin Lisp code %s" interactive-only))
482 ((and (symbolp 'interactive-only) 478 ((and (symbolp 'interactive-only)
483 (not (eq interactive-only t))) 479 (not (eq interactive-only t)))
484 (format (substitute-command-keys 480 (format-message ";\nin Lisp code use ‘%s’ instead."
485 ";\nin Lisp code use ‘%s’ instead.") 481 interactive-only))
486 interactive-only))
487 (t ".")) 482 (t "."))
488 "\n"))))) 483 "\n")))))
489 484
@@ -551,8 +546,7 @@ FILE is the file where FUNCTION was probably defined."
551 ;; Aliases are Lisp functions, so we need to check 546 ;; Aliases are Lisp functions, so we need to check
552 ;; aliases before functions. 547 ;; aliases before functions.
553 (aliased 548 (aliased
554 (format (substitute-command-keys "an alias for ‘%s’") 549 (format-message "an alias for ‘%s’" real-def))
555 real-def))
556 ((autoloadp def) 550 ((autoloadp def)
557 (format "%s autoloaded %s" 551 (format "%s autoloaded %s"
558 (if (commandp def) "an interactive" "an") 552 (if (commandp def) "an interactive" "an")
@@ -592,13 +586,12 @@ FILE is the file where FUNCTION was probably defined."
592 (help-xref-button 1 'help-function real-def))))) 586 (help-xref-button 1 'help-function real-def)))))
593 587
594 (when file-name 588 (when file-name
595 (princ (substitute-command-keys " in ‘"))
596 ;; We used to add .el to the file name, 589 ;; We used to add .el to the file name,
597 ;; but that's completely wrong when the user used load-file. 590 ;; but that's completely wrong when the user used load-file.
598 (princ (if (eq file-name 'C-source) 591 (princ (format-message " in ‘%s’"
599 "C source code" 592 (if (eq file-name 'C-source)
600 (help-fns-short-filename file-name))) 593 "C source code"
601 (princ (substitute-command-keys "’")) 594 (help-fns-short-filename file-name))))
602 ;; Make a hyperlink to the library. 595 ;; Make a hyperlink to the library.
603 (with-current-buffer standard-output 596 (with-current-buffer standard-output
604 (save-excursion 597 (save-excursion
@@ -736,12 +729,11 @@ it is displayed along with the global value."
736 729
737 (if file-name 730 (if file-name
738 (progn 731 (progn
739 (princ (substitute-command-keys 732 (princ (format-message
740 " is a variable defined in ‘")) 733 " is a variable defined in ‘%s’.\n"
741 (princ (if (eq file-name 'C-source) 734 (if (eq file-name 'C-source)
742 "C source code" 735 "C source code"
743 (file-name-nondirectory file-name))) 736 (file-name-nondirectory file-name))))
744 (princ (substitute-command-keys "’.\n"))
745 (with-current-buffer standard-output 737 (with-current-buffer standard-output
746 (save-excursion 738 (save-excursion
747 (re-search-backward (substitute-command-keys 739 (re-search-backward (substitute-command-keys
@@ -876,9 +868,9 @@ if it is given a local binding.\n")))
876 ;; Mention if it's an alias. 868 ;; Mention if it's an alias.
877 (unless (eq alias variable) 869 (unless (eq alias variable)
878 (setq extra-line t) 870 (setq extra-line t)
879 (princ (format (substitute-command-keys 871 (princ (format-message
880 " This variable is an alias for ‘%s’.\n") 872 " This variable is an alias for ‘%s’.\n"
881 alias))) 873 alias)))
882 874
883 (when obsolete 875 (when obsolete
884 (setq extra-line t) 876 (setq extra-line t)
@@ -886,9 +878,8 @@ if it is given a local binding.\n")))
886 (if (nth 2 obsolete) 878 (if (nth 2 obsolete)
887 (princ (format " since %s" (nth 2 obsolete)))) 879 (princ (format " since %s" (nth 2 obsolete))))
888 (princ (cond ((stringp use) (concat ";\n " use)) 880 (princ (cond ((stringp use) (concat ";\n " use))
889 (use (format (substitute-command-keys 881 (use (format-message ";\n use ‘%s’ instead."
890 ";\n use ‘%s’ instead.") 882 (car obsolete)))
891 (car obsolete)))
892 (t "."))) 883 (t ".")))
893 (terpri)) 884 (terpri))
894 885
@@ -950,8 +941,7 @@ file-local variable.\n")
950 (princ "if its value\n satisfies the predicate ") 941 (princ "if its value\n satisfies the predicate ")
951 (princ (if (byte-code-function-p safe-var) 942 (princ (if (byte-code-function-p safe-var)
952 "which is a byte-compiled expression.\n" 943 "which is a byte-compiled expression.\n"
953 (format (substitute-command-keys "‘%s’.\n") 944 (format-message "‘%s’.\n" safe-var))))
954 safe-var))))
955 945
956 (if extra-line (terpri)) 946 (if extra-line (terpri))
957 (princ "Documentation:\n") 947 (princ "Documentation:\n")
diff --git a/lisp/help.el b/lisp/help.el
index db87d5852b6..2fcb52e2e25 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -964,9 +964,8 @@ documentation for the major and minor modes of that buffer."
964 (let* ((mode major-mode) 964 (let* ((mode major-mode)
965 (file-name (find-lisp-object-file-name mode nil))) 965 (file-name (find-lisp-object-file-name mode nil)))
966 (when file-name 966 (when file-name
967 (princ (concat (substitute-command-keys " defined in ‘") 967 (princ (format-message " defined in ‘%s’"
968 (file-name-nondirectory file-name) 968 (file-name-nondirectory file-name)))
969 (substitute-command-keys "’")))
970 ;; Make a hyperlink to the library. 969 ;; Make a hyperlink to the library.
971 (with-current-buffer standard-output 970 (with-current-buffer standard-output
972 (save-excursion 971 (save-excursion
diff --git a/lisp/info-xref.el b/lisp/info-xref.el
index 3e871a1a3fc..2b81efa178e 100644
--- a/lisp/info-xref.el
+++ b/lisp/info-xref.el
@@ -170,13 +170,13 @@ overall good/bad count summary inserted at the very end."
170 info-xref-good info-xref-bad info-xref-unavail)))) 170 info-xref-good info-xref-bad info-xref-unavail))))
171 171
172(defun info-xref-output (fmt &rest args) 172(defun info-xref-output (fmt &rest args)
173 "Emit a `format'-ed message FMT+ARGS to the `info-xref-output-buffer'." 173 "Emit a `format-message'-ed message FMT+ARGS to the `info-xref-output-buffer'."
174 (with-current-buffer info-xref-output-buffer 174 (with-current-buffer info-xref-output-buffer
175 (save-excursion 175 (save-excursion
176 (goto-char (point-max)) 176 (goto-char (point-max))
177 (let ((inhibit-read-only t)) 177 (let ((inhibit-read-only t))
178 (insert info-xref-output-heading 178 (insert info-xref-output-heading
179 (apply 'format fmt args) 179 (apply #'format-message fmt args)
180 "\n"))) 180 "\n")))
181 (setq info-xref-output-heading "") 181 (setq info-xref-output-heading "")
182 ;; all this info-xref can be pretty slow, display now so the user sees 182 ;; all this info-xref can be pretty slow, display now so the user sees
diff --git a/lisp/info.el b/lisp/info.el
index 454fadaca03..74ca947e011 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3460,7 +3460,7 @@ MATCHES is a list of index matches found by `Info-index'.")
3460 (when (equal (car (nth 0 nodeinfo)) (or filename Info-current-file)) 3460 (when (equal (car (nth 0 nodeinfo)) (or filename Info-current-file))
3461 (insert 3461 (insert
3462 (format "* %-20s %s.\n" 3462 (format "* %-20s %s.\n"
3463 (format "*Index for ‘%s’*::" (cdr (nth 0 nodeinfo))) 3463 (format-message "*Index for ‘%s’*::" (cdr (nth 0 nodeinfo)))
3464 (cdr (nth 0 nodeinfo))))))))) 3464 (cdr (nth 0 nodeinfo)))))))))
3465 3465
3466(defun Info-virtual-index (topic) 3466(defun Info-virtual-index (topic)
@@ -3495,7 +3495,8 @@ search results."
3495 (setq Info-history-list ohist-list) 3495 (setq Info-history-list ohist-list)
3496 (Info-goto-node orignode) 3496 (Info-goto-node orignode)
3497 (message ""))) 3497 (message "")))
3498 (Info-find-node Info-current-file (format "*Index for ‘%s’*" topic)))) 3498 (Info-find-node Info-current-file
3499 (format-message "*Index for ‘%s’*" topic))))
3499 3500
3500(add-to-list 'Info-virtual-files 3501(add-to-list 'Info-virtual-files
3501 '("\\`\\*Apropos\\*\\'" 3502 '("\\`\\*Apropos\\*\\'"
@@ -3634,7 +3635,7 @@ Build a menu of the possible matches."
3634 (setq nodes (cdr nodes))) 3635 (setq nodes (cdr nodes)))
3635 (if nodes 3636 (if nodes
3636 (Info-find-node Info-apropos-file (car (car nodes))) 3637 (Info-find-node Info-apropos-file (car (car nodes)))
3637 (setq nodename (format "Index for ‘%s’" string)) 3638 (setq nodename (format-message "Index for ‘%s’" string))
3638 (push (list nodename string (Info-apropos-matches string)) 3639 (push (list nodename string (Info-apropos-matches string))
3639 Info-apropos-nodes) 3640 Info-apropos-nodes)
3640 (Info-find-node Info-apropos-file nodename))))) 3641 (Info-find-node Info-apropos-file nodename)))))
diff --git a/lisp/international/kkc.el b/lisp/international/kkc.el
index 90fb1519272..7eb8a4d4d4a 100644
--- a/lisp/international/kkc.el
+++ b/lisp/international/kkc.el
@@ -209,7 +209,7 @@ area while indicating the current selection by `<N>'."
209 209
210(define-error 'kkc-error nil) 210(define-error 'kkc-error nil)
211(defun kkc-error (&rest args) 211(defun kkc-error (&rest args)
212 (signal 'kkc-error (apply 'format args))) 212 (signal 'kkc-error (apply #'format-message args)))
213 213
214(defvar kkc-converting nil) 214(defvar kkc-converting nil)
215 215
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 2142f0bb961..16666acb567 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -719,14 +719,14 @@ DEFAULT is the coding system to use by default in the query."
719 (insert "No default coding systems to try for " 719 (insert "No default coding systems to try for "
720 (if (stringp from) 720 (if (stringp from)
721 (format "string \"%s\"." from) 721 (format "string \"%s\"." from)
722 (format "buffer ‘%s’." bufname))) 722 (format-message "buffer ‘%s’." bufname)))
723 (insert 723 (insert
724 "These default coding systems were tried to encode" 724 "These default coding systems were tried to encode"
725 (if (stringp from) 725 (if (stringp from)
726 (concat " \"" (if (> (length from) 10) 726 (concat " \"" (if (> (length from) 10)
727 (concat (substring from 0 10) "...\"") 727 (concat (substring from 0 10) "...\"")
728 (concat from "\""))) 728 (concat from "\"")))
729 (format " text\nin the buffer ‘%s’" bufname)) 729 (format-message " text\nin the buffer ‘%s’" bufname))
730 ":\n") 730 ":\n")
731 (let ((pos (point)) 731 (let ((pos (point))
732 (fill-prefix " ")) 732 (fill-prefix " "))
@@ -881,7 +881,7 @@ for the current buffer/file by the %s.
881It is highly recommended to fix it before writing to a file." 881It is highly recommended to fix it before writing to a file."
882 (car auto-cs) 882 (car auto-cs)
883 (if (eq (cdr auto-cs) :coding) ":coding tag" 883 (if (eq (cdr auto-cs) :coding) ":coding tag"
884 (format "variable ‘%s’" (cdr auto-cs)))) 884 (format-message "variable ‘%s’" (cdr auto-cs))))
885 :warning) 885 :warning)
886 (or (yes-or-no-p "Really proceed with writing? ") 886 (or (yes-or-no-p "Really proceed with writing? ")
887 (error "Save aborted")) 887 (error "Save aborted"))
@@ -1587,7 +1587,7 @@ which marks the variable `default-input-method' as set for Custom buffers."
1587 (called-interactively-p 'interactive)) 1587 (called-interactively-p 'interactive))
1588 (with-output-to-temp-buffer (help-buffer) 1588 (with-output-to-temp-buffer (help-buffer)
1589 (let ((elt (assoc input-method input-method-alist))) 1589 (let ((elt (assoc input-method input-method-alist)))
1590 (princ (format 1590 (princ (format-message
1591 "Input method: %s (‘%s’ in mode line) for %s\n %s\n" 1591 "Input method: %s (‘%s’ in mode line) for %s\n %s\n"
1592 input-method (nth 3 elt) (nth 1 elt) (nth 4 elt)))))))))) 1592 input-method (nth 3 elt) (nth 1 elt) (nth 4 elt))))))))))
1593 1593
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index c3d58aa0397..063b873726a 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -904,8 +904,9 @@
904 (dolist (script '(devanagari sanskrit bengali tamil telugu assamese 904 (dolist (script '(devanagari sanskrit bengali tamil telugu assamese
905 oriya kannada malayalam gujarati punjabi)) 905 oriya kannada malayalam gujarati punjabi))
906 (define-charset (intern (format "%s-cdac" script)) 906 (define-charset (intern (format "%s-cdac" script))
907 (format "Glyphs of %s script for CDAC font. Subset of ‘indian-glyph’." 907 (format-message
908 (capitalize (symbol-name script))) 908 "Glyphs of %s script for CDAC font. Subset of ‘indian-glyph’."
909 (capitalize (symbol-name script)))
909 :short-name (format "CDAC %s glyphs" (capitalize (symbol-name script))) 910 :short-name (format "CDAC %s glyphs" (capitalize (symbol-name script)))
910 :supplementary-p t 911 :supplementary-p t
911 :code-space [0 255] 912 :code-space [0 255]
@@ -915,8 +916,9 @@
915 (dolist (script '(devanagari bengali punjabi gujarati 916 (dolist (script '(devanagari bengali punjabi gujarati
916 oriya tamil telugu kannada malayalam)) 917 oriya tamil telugu kannada malayalam))
917 (define-charset (intern (format "%s-akruti" script)) 918 (define-charset (intern (format "%s-akruti" script))
918 (format "Glyphs of %s script for AKRUTI font. Subset of ‘indian-glyph’." 919 (format-message
919 (capitalize (symbol-name script))) 920 "Glyphs of %s script for AKRUTI font. Subset of ‘indian-glyph’."
921 (capitalize (symbol-name script)))
920 :short-name (format "AKRUTI %s glyphs" (capitalize (symbol-name script))) 922 :short-name (format "AKRUTI %s glyphs" (capitalize (symbol-name script)))
921 :supplementary-p t 923 :supplementary-p t
922 :code-space [0 255] 924 :code-space [0 255]
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index 7ef758b58de..57b6d62e4aa 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -332,7 +332,7 @@ meanings of these arguments."
332 (let ((char (charset-iso-final-char charset))) 332 (let ((char (charset-iso-final-char charset)))
333 (when (> char 0) 333 (when (> char 0)
334 (insert "Final char of ISO2022 designation sequence: ") 334 (insert "Final char of ISO2022 designation sequence: ")
335 (insert (format "‘%c’\n" char)))) 335 (insert (format-message "‘%c’\n" char))))
336 (let (aliases) 336 (let (aliases)
337 (dolist (c charset-list) 337 (dolist (c charset-list)
338 (if (and (not (eq c charset)) 338 (if (and (not (eq c charset))
@@ -1058,17 +1058,18 @@ installed LEIM (Libraries of Emacs Input Methods).")
1058 (setq language (nth 1 elt)) 1058 (setq language (nth 1 elt))
1059 (princ language) 1059 (princ language)
1060 (terpri)) 1060 (terpri))
1061 (princ (format " %s (‘%s’ in mode line)\n %s\n" 1061 (princ (format-message
1062 (car elt) 1062 " %s (‘%s’ in mode line)\n %s\n"
1063 (let ((title (nth 3 elt))) 1063 (car elt)
1064 (if (and (consp title) (stringp (car title))) 1064 (let ((title (nth 3 elt)))
1065 (car title) 1065 (if (and (consp title) (stringp (car title)))
1066 title)) 1066 (car title)
1067 ;; If the doc is multi-line, indent all 1067 title))
1068 ;; non-blank lines. (Bug#8066) 1068 ;; If the doc is multi-line, indent all
1069 (replace-regexp-in-string 1069 ;; non-blank lines. (Bug#8066)
1070 "\n\\(.\\)" "\n \\1" 1070 (replace-regexp-in-string
1071 (substitute-command-keys (or (nth 4 elt) ""))))))))) 1071 "\n\\(.\\)" "\n \\1"
1072 (substitute-command-keys (or (nth 4 elt) "")))))))))
1072 1073
1073;;; DIAGNOSIS 1074;;; DIAGNOSIS
1074 1075
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index f60af4ab9b6..8c9d1457634 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -1305,7 +1305,7 @@ The returned value is a Quail map specific to KEY."
1305 1305
1306(define-error 'quail-error nil) 1306(define-error 'quail-error nil)
1307(defun quail-error (&rest args) 1307(defun quail-error (&rest args)
1308 (signal 'quail-error (apply 'format args))) 1308 (signal 'quail-error (apply #'format-message args)))
1309 1309
1310(defun quail-input-string-to-events (str) 1310(defun quail-input-string-to-events (str)
1311 "Convert input string STR to a list of events. 1311 "Convert input string STR to a list of events.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 411416b1bfa..689911c405a 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -687,7 +687,7 @@ for use at QPOS."
687The text is displayed for `minibuffer-message-timeout' seconds, 687The text is displayed for `minibuffer-message-timeout' seconds,
688or until the next input event arrives, whichever comes first. 688or until the next input event arrives, whichever comes first.
689Enclose MESSAGE in [...] if this is not yet the case. 689Enclose MESSAGE in [...] if this is not yet the case.
690If ARGS are provided, then pass MESSAGE through `format'." 690If ARGS are provided, then pass MESSAGE through `format-message'."
691 (if (not (minibufferp (current-buffer))) 691 (if (not (minibufferp (current-buffer)))
692 (progn 692 (progn
693 (if args 693 (if args
@@ -702,7 +702,7 @@ If ARGS are provided, then pass MESSAGE through `format'."
702 ;; Make sure we can put-text-property. 702 ;; Make sure we can put-text-property.
703 (copy-sequence message) 703 (copy-sequence message)
704 (concat " [" message "]"))) 704 (concat " [" message "]")))
705 (when args (setq message (apply 'format message args))) 705 (when args (setq message (apply #'format-message message args)))
706 (let ((ol (make-overlay (point-max) (point-max) nil t t)) 706 (let ((ol (make-overlay (point-max) (point-max) nil t t))
707 ;; A quit during sit-for normally only interrupts the sit-for, 707 ;; A quit during sit-for normally only interrupts the sit-for,
708 ;; but since minibuffer-message is used at the end of a command, 708 ;; but since minibuffer-message is used at the end of a command,
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 76c08dbcbeb..fb59adf30ff 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -217,7 +217,7 @@ defaults to 6600 and HOST defaults to localhost."
217 (goto-char (point-max)) 217 (goto-char (point-max))
218 (insert-before-markers ;So it scrolls. 218 (insert-before-markers ;So it scrolls.
219 (replace-regexp-in-string "\n" "\n " 219 (replace-regexp-in-string "\n" "\n "
220 (apply 'format format args)) 220 (apply #'format-message format args))
221 "\n")))) 221 "\n"))))
222 222
223(defun mpc--proc-filter (proc string) 223(defun mpc--proc-filter (proc string)
@@ -1643,7 +1643,7 @@ Return non-nil if a selection was deactivated."
1643 (when (equal (sort (copy-sequence active) #'string-lessp) 1643 (when (equal (sort (copy-sequence active) #'string-lessp)
1644 (sort (copy-sequence selection) #'string-lessp)) 1644 (sort (copy-sequence selection) #'string-lessp))
1645 (setq active 'all))) 1645 (setq active 'all)))
1646 1646
1647 ;; FIXME: This `mpc-sort' takes a lot of time. Maybe we should 1647 ;; FIXME: This `mpc-sort' takes a lot of time. Maybe we should
1648 ;; be more clever and presume the buffer is mostly sorted already. 1648 ;; be more clever and presume the buffer is mostly sorted already.
1649 (mpc-sort (if (listp active) active)) 1649 (mpc-sort (if (listp active) active))
diff --git a/lisp/msb.el b/lisp/msb.el
index 149d1934463..03b29202efe 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -745,8 +745,8 @@ to the buffer-list variable in FUNCTION-INFO."
745 (msb--add-to-menu buffer info max-buffer-name-length))) 745 (msb--add-to-menu buffer info max-buffer-name-length)))
746 (error (unless msb--error 746 (error (unless msb--error
747 (setq msb--error 747 (setq msb--error
748 (format 748 (format-message
749 "In msb-menu-cond, error for buffer `%s'." 749 "In msb-menu-cond, error for buffer %s."
750 (buffer-name buffer))) 750 (buffer-name buffer)))
751 (error "%s" msb--error)))))) 751 (error "%s" msb--error))))))
752 752
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 0685bac26c7..62ee31657e1 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -1107,7 +1107,7 @@ All HOST values should be in lower case.")
1107(defun ange-ftp-message (fmt &rest args) 1107(defun ange-ftp-message (fmt &rest args)
1108 "Display message in echo area, but indicate if truncated. 1108 "Display message in echo area, but indicate if truncated.
1109Args are as in `message': a format string, plus arguments to be formatted." 1109Args are as in `message': a format string, plus arguments to be formatted."
1110 (let ((msg (apply 'format fmt args)) 1110 (let ((msg (apply #'format-message fmt args))
1111 (max (window-width (minibuffer-window)))) 1111 (max (window-width (minibuffer-window))))
1112 (if noninteractive 1112 (if noninteractive
1113 msg 1113 msg
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el
index 235b2a2a111..418796a89c9 100644
--- a/lisp/net/gnutls.el
+++ b/lisp/net/gnutls.el
@@ -259,7 +259,7 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT."
259 (message "%s: (err=[%s] %s) %s" 259 (message "%s: (err=[%s] %s) %s"
260 "gnutls.el" 260 "gnutls.el"
261 doit (gnutls-error-string doit) 261 doit (gnutls-error-string doit)
262 (apply 'format format (or params '(nil)))))) 262 (apply #'format-message format (or params '(nil))))))
263 263
264(provide 'gnutls) 264(provide 'gnutls)
265 265
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 435851cc504..01755488a64 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -846,10 +846,10 @@ Argument BUFFER is the buffer of the retrieval process."
846 newsticker--cache 846 newsticker--cache
847 name-symbol 847 name-symbol
848 newsticker--error-headline 848 newsticker--error-headline
849 (format 849 (format-message
850 (concat "%s: Newsticker could not retrieve news from %s.\n" 850 (concat "%s: Newsticker could not retrieve news from %s.\n"
851 "Return status: `%s'\n" 851 "Return status: %s\n"
852 "Command was `%s'") 852 "Command was %s")
853 (format-time-string "%A, %H:%M") 853 (format-time-string "%A, %H:%M")
854 feed-name event command) 854 feed-name event command)
855 "" 855 ""
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index eca2a9c3eca..ef8507e25ce 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -1268,8 +1268,8 @@ Note: does not update the layout."
1268 (expand-file-name (concat newsticker-dir "/groups")))) 1268 (expand-file-name (concat newsticker-dir "/groups"))))
1269 (file-exists-p newsticker-groups-filename) 1269 (file-exists-p newsticker-groups-filename)
1270 (y-or-n-p 1270 (y-or-n-p
1271 (format 1271 (format-message
1272 (concat "Obsolete variable `newsticker-groups-filename' " 1272 (concat "Obsolete variable newsticker-groups-filename "
1273 "points to existing file \"%s\".\n" 1273 "points to existing file \"%s\".\n"
1274 "Read it? ") 1274 "Read it? ")
1275 newsticker-groups-filename)) 1275 newsticker-groups-filename))
@@ -1279,9 +1279,9 @@ Note: does not update the layout."
1279 (find-file-noselect filename)))) 1279 (find-file-noselect filename))))
1280 (and newsticker-groups-filename 1280 (and newsticker-groups-filename
1281 (file-exists-p newsticker-groups-filename) 1281 (file-exists-p newsticker-groups-filename)
1282 (y-or-n-p (format 1282 (y-or-n-p (format-message
1283 (concat "Delete the file \"%s\",\nto which the obsolete " 1283 (concat "Delete the file \"%s\",\nto which the obsolete "
1284 "variable `newsticker-groups-filename' points ? ") 1284 "variable newsticker-groups-filename points ? ")
1285 newsticker-groups-filename)) 1285 newsticker-groups-filename))
1286 (delete-file newsticker-groups-filename)) 1286 (delete-file newsticker-groups-filename))
1287 (when buf 1287 (when buf
diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el
index 261e5a1a36c..c54553ae5ea 100644
--- a/lisp/net/nsm.el
+++ b/lisp/net/nsm.el
@@ -304,7 +304,7 @@ unencrypted."
304 (when (> (length cert) 0) 304 (when (> (length cert) 0)
305 (insert cert "\n")) 305 (insert cert "\n"))
306 (let ((start (point))) 306 (let ((start (point)))
307 (insert (apply 'format message args)) 307 (insert (apply #'format-message message args))
308 (goto-char start) 308 (goto-char start)
309 ;; Fill the first line of the message, which usually 309 ;; Fill the first line of the message, which usually
310 ;; contains lots of explanatory text. 310 ;; contains lots of explanatory text.
diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el
index e71179b6b89..c0dcc2332fe 100644
--- a/lisp/net/rlogin.el
+++ b/lisp/net/rlogin.el
@@ -174,8 +174,8 @@ If you wish to change directory tracking styles during a session, use the
174function `rlogin-directory-tracking-mode' rather than simply setting the 174function `rlogin-directory-tracking-mode' rather than simply setting the
175variable." 175variable."
176 (interactive (list 176 (interactive (list
177 (read-from-minibuffer (format 177 (read-from-minibuffer (format-message
178 "Arguments for `%s' (hostname first): " 178 "Arguments for %s (hostname first): "
179 (file-name-nondirectory rlogin-program)) 179 (file-name-nondirectory rlogin-program))
180 nil nil nil 'rlogin-history) 180 nil nil nil 'rlogin-history)
181 current-prefix-arg)) 181 current-prefix-arg))
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index 3fc60225c5a..a05108df0ae 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -51,7 +51,8 @@
51 51
52(defsubst soap-warning (message &rest args) 52(defsubst soap-warning (message &rest args)
53 "Display a warning MESSAGE with ARGS, using the 'soap-client warning type." 53 "Display a warning MESSAGE with ARGS, using the 'soap-client warning type."
54 (display-warning 'soap-client (apply 'format message args) :warning)) 54 (display-warning 'soap-client (apply #'format-message message args)
55 :warning))
55 56
56(defgroup soap-client nil 57(defgroup soap-client nil
57 "Access SOAP web services from Emacs." 58 "Access SOAP web services from Emacs."
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 193d70b230a..69d7e1fe613 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1504,7 +1504,7 @@ ARGUMENTS to actually emit the message (if applicable)."
1504; (1+ (count-lines (point-min) (cdr ffn))))))) 1504; (1+ (count-lines (point-min) (cdr ffn)))))))
1505 (insert (format "%s " fn))) 1505 (insert (format "%s " fn)))
1506 ;; The message. 1506 ;; The message.
1507 (insert (apply 'format fmt-string arguments)))) 1507 (insert (apply #'format-message fmt-string arguments))))
1508 1508
1509(defvar tramp-message-show-message t 1509(defvar tramp-message-show-message t
1510 "Show Tramp message in the minibuffer. 1510 "Show Tramp message in the minibuffer.
@@ -1581,8 +1581,8 @@ signal identifier to be raised, remaining arguments passed to
1581 (error-message-string 1581 (error-message-string
1582 (list signal 1582 (list signal
1583 (get signal 'error-message) 1583 (get signal 'error-message)
1584 (apply 'format fmt-string arguments))))) 1584 (apply #'format-message fmt-string arguments)))))
1585 (signal signal (list (apply 'format fmt-string arguments))))) 1585 (signal signal (list (apply #'format-message fmt-string arguments)))))
1586 1586
1587(defsubst tramp-error-with-buffer 1587(defsubst tramp-error-with-buffer
1588 (buf vec-or-proc signal fmt-string &rest arguments) 1588 (buf vec-or-proc signal fmt-string &rest arguments)
@@ -3599,8 +3599,8 @@ connection buffer."
3599 "Tramp failed to connect. If this happens repeatedly, try\n" 3599 "Tramp failed to connect. If this happens repeatedly, try\n"
3600 " `\\[tramp-cleanup-this-connection]'"))) 3600 " `\\[tramp-cleanup-this-connection]'")))
3601 ((eq exit 'timeout) 3601 ((eq exit 'timeout)
3602 (format 3602 (format-message
3603 "Timeout reached, see buffer `%s' for details" 3603 "Timeout reached, see buffer %s for details"
3604 (tramp-get-connection-buffer vec))) 3604 (tramp-get-connection-buffer vec)))
3605 (t "Login failed"))))) 3605 (t "Login failed")))))
3606 (when (numberp pos) 3606 (when (numberp pos)
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el
index a8dc5b158b2..c87cd5378fa 100644
--- a/lisp/nxml/nxml-outln.el
+++ b/lisp/nxml/nxml-outln.el
@@ -1003,7 +1003,7 @@ immediately after the section's start-tag."
1003;;; Error handling 1003;;; Error handling
1004 1004
1005(defun nxml-report-outline-error (msg err) 1005(defun nxml-report-outline-error (msg err)
1006 (error msg (apply 'format (cdr err)))) 1006 (error msg (apply #'format-message (cdr err))))
1007 1007
1008(defun nxml-outline-error (&rest args) 1008(defun nxml-outline-error (&rest args)
1009 (signal 'nxml-outline-error args)) 1009 (signal 'nxml-outline-error args))
diff --git a/lisp/nxml/nxml-parse.el b/lisp/nxml/nxml-parse.el
index c0a8497970c..d8523ee9dbe 100644
--- a/lisp/nxml/nxml-parse.el
+++ b/lisp/nxml/nxml-parse.el
@@ -304,7 +304,7 @@ same way as well-formedness error."
304(defun nxml-parse-error (position &rest args) 304(defun nxml-parse-error (position &rest args)
305 (nxml-signal-file-parse-error nxml-parse-file-name 305 (nxml-signal-file-parse-error nxml-parse-file-name
306 (or position xmltok-start) 306 (or position xmltok-start)
307 (apply 'format args))) 307 (apply #'format-message args)))
308 308
309(defun nxml-check-xmltok-errors () 309(defun nxml-check-xmltok-errors ()
310 (when xmltok-errors 310 (when xmltok-errors
diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el
index 59340316980..31864a4dfc3 100644
--- a/lisp/nxml/rng-cmpct.el
+++ b/lisp/nxml/rng-cmpct.el
@@ -400,7 +400,7 @@ OVERRIDE is either nil, require or t."
400(defun rng-c-error (&rest args) 400(defun rng-c-error (&rest args)
401 (rng-c-signal-incorrect-schema rng-c-file-name 401 (rng-c-signal-incorrect-schema rng-c-file-name
402 (rng-c-translate-position (point)) 402 (rng-c-translate-position (point))
403 (apply 'format args))) 403 (apply #'format-message args)))
404 404
405(defun rng-c-parse-top-level (context) 405(defun rng-c-parse-top-level (context)
406 (let ((rng-c-namespace-decls nil) 406 (let ((rng-c-namespace-decls nil)
diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el
index 8ebb573dcc3..ef55e85f300 100644
--- a/lisp/nxml/rng-match.el
+++ b/lisp/nxml/rng-match.el
@@ -1504,7 +1504,7 @@ nullable and y1 isn't, return a choice
1504 1504
1505(defun rng-compile-error (&rest args) 1505(defun rng-compile-error (&rest args)
1506 (signal 'rng-compile-error 1506 (signal 'rng-compile-error
1507 (list (apply 'format args)))) 1507 (list (apply #'format-message args))))
1508 1508
1509(define-error 'rng-compile-error "Incorrect schema" 'rng-error) 1509(define-error 'rng-compile-error "Incorrect schema" 'rng-error)
1510 1510
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el
index e95ad08d1bd..98b43848f01 100644
--- a/lisp/nxml/rng-uri.el
+++ b/lisp/nxml/rng-uri.el
@@ -125,7 +125,7 @@ Signal an error if URI is not a valid file URL."
125 (t path)))) 125 (t path))))
126 126
127(defun rng-uri-error (&rest args) 127(defun rng-uri-error (&rest args)
128 (signal 'rng-uri-error (list (apply 'format args)))) 128 (signal 'rng-uri-error (list (apply #'format-message args))))
129 129
130(define-error 'rng-uri-error "Invalid URI") 130(define-error 'rng-uri-error "Invalid URI")
131 131
diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el
index 111de8537d3..e0d78e1bcf6 100644
--- a/lisp/obsolete/iswitchb.el
+++ b/lisp/obsolete/iswitchb.el
@@ -1095,8 +1095,8 @@ Return the modified list with the last element prepended to it."
1095 1095
1096 (and iswitchb-prompt-newbuffer 1096 (and iswitchb-prompt-newbuffer
1097 (y-or-n-p 1097 (y-or-n-p
1098 (format 1098 (format-message
1099 "No buffer matching `%s', create one? " 1099 "No buffer matching %s, create one? "
1100 buf))))) 1100 buf)))))
1101 ;; then create a new buffer 1101 ;; then create a new buffer
1102 (progn 1102 (progn
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
index a9baf04b634..911ee2e923b 100644
--- a/lisp/org/org-ctags.el
+++ b/lisp/org/org-ctags.el
@@ -455,8 +455,8 @@ to rebuild (update) the TAGS file."
455Wrapper for org-ctags-rebuild-tags-file-then-find-tag." 455Wrapper for org-ctags-rebuild-tags-file-then-find-tag."
456 (if (and (buffer-file-name) 456 (if (and (buffer-file-name)
457 (y-or-n-p 457 (y-or-n-p
458 (format 458 (format-message
459 "Tag `%s' not found. Rebuild table `%s/TAGS' and look again?" 459 "Tag %s not found. Rebuild table %s/TAGS and look again?"
460 name 460 name
461 (file-name-directory (buffer-file-name))))) 461 (file-name-directory (buffer-file-name)))))
462 (org-ctags-rebuild-tags-file-then-find-tag name) 462 (org-ctags-rebuild-tags-file-then-find-tag name)
diff --git a/lisp/proced.el b/lisp/proced.el
index 69355ab044a..922e016a765 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1915,7 +1915,7 @@ and \f (formfeed) at the end."
1915 (let (buffer-read-only) 1915 (let (buffer-read-only)
1916 (cond ((stringp log) 1916 (cond ((stringp log)
1917 (insert (if args 1917 (insert (if args
1918 (apply 'format log args) 1918 (apply #'format-message log args)
1919 log))) 1919 log)))
1920 ((bufferp log) 1920 ((bufferp log)
1921 (insert-buffer-substring log)) 1921 (insert-buffer-substring log))
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index a897f96905a..c694bbd5832 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -6345,7 +6345,7 @@ killed after process termination."
6345 (when ebnf-log 6345 (when ebnf-log
6346 (with-current-buffer (get-buffer-create "*Ebnf2ps Log*") 6346 (with-current-buffer (get-buffer-create "*Ebnf2ps Log*")
6347 (goto-char (point-max)) 6347 (goto-char (point-max))
6348 (insert (apply 'format format-str args) "\n")))) 6348 (insert (apply #'format-message format-str args) "\n"))))
6349 6349
6350 6350
6351;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 6351;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index bb5ac635883..1942271e561 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -200,7 +200,7 @@ ignored. Otherwise, it is printed using `message'.
200TEXT is a format control string, and the remaining arguments ARGS 200TEXT is a format control string, and the remaining arguments ARGS
201are the string substitutions (see the function `format')." 201are the string substitutions (see the function `format')."
202 (if (<= level flymake-log-level) 202 (if (<= level flymake-log-level)
203 (let* ((msg (apply 'format text args))) 203 (let* ((msg (apply #'format-message text args)))
204 (message "%s" msg)))) 204 (message "%s" msg))))
205 205
206(defun flymake-ins-after (list pos val) 206(defun flymake-ins-after (list pos val)
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 451acd2cb9c..1b270e66dda 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -2305,11 +2305,12 @@ Ignore byte-compiler warnings you might see."
2305 2305
2306(defun vhdl-warning-when-idle (&rest args) 2306(defun vhdl-warning-when-idle (&rest args)
2307 "Wait until idle, then print out warning STRING and beep." 2307 "Wait until idle, then print out warning STRING and beep."
2308 (if noninteractive 2308 (let ((message (apply #'format-message args)))
2309 (vhdl-warning (apply 'format args) t) 2309 (if noninteractive
2310 (unless vhdl-warnings 2310 (vhdl-warning message t)
2311 (vhdl-run-when-idle .1 nil 'vhdl-print-warnings)) 2311 (unless vhdl-warnings
2312 (push (apply 'format args) vhdl-warnings))) 2312 (vhdl-run-when-idle .1 nil 'vhdl-print-warnings))
2313 (push message vhdl-warnings))))
2313 2314
2314(defun vhdl-warning (string &optional nobeep) 2315(defun vhdl-warning (string &optional nobeep)
2315 "Print out warning STRING and beep." 2316 "Print out warning STRING and beep."
diff --git a/lisp/replace.el b/lisp/replace.el
index 3cdb54f2132..26870a3a634 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1495,7 +1495,8 @@ See also `multi-occur'."
1495 ;; Don't display regexp if with remaining text 1495 ;; Don't display regexp if with remaining text
1496 ;; it is longer than window-width. 1496 ;; it is longer than window-width.
1497 (if (> (+ (length regexp) 42) (window-width)) 1497 (if (> (+ (length regexp) 42) (window-width))
1498 "" (format " for ‘%s’" (query-replace-descr regexp))))) 1498 "" (format-message
1499 " for ‘%s’" (query-replace-descr regexp)))))
1499 (setq occur-revert-arguments (list regexp nlines bufs)) 1500 (setq occur-revert-arguments (list regexp nlines bufs))
1500 (if (= count 0) 1501 (if (= count 0)
1501 (kill-buffer occur-buf) 1502 (kill-buffer occur-buf)
diff --git a/lisp/simple.el b/lisp/simple.el
index ea439757858..87d944482ab 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1689,11 +1689,11 @@ invoking, give a prefix argument to `execute-extended-command'."
1689 (symbol-name function) typed)))) 1689 (symbol-name function) typed))))
1690 (when binding 1690 (when binding
1691 (with-temp-message 1691 (with-temp-message
1692 (format "You can run the command ‘%s’ with %s" 1692 (format-message "You can run the command ‘%s’ with %s"
1693 function 1693 function
1694 (if (stringp binding) 1694 (if (stringp binding)
1695 (concat "M-x " binding " RET") 1695 (concat "M-x " binding " RET")
1696 (key-description binding))) 1696 (key-description binding)))
1697 (sit-for (if (numberp suggest-key-bindings) 1697 (sit-for (if (numberp suggest-key-bindings)
1698 suggest-key-bindings 1698 suggest-key-bindings
1699 2)))))))) 1699 2))))))))
@@ -2796,16 +2796,18 @@ This variable only matters if `undo-ask-before-discard' is non-nil.")
2796 ;; but we don't want to ask the question again. 2796 ;; but we don't want to ask the question again.
2797 (setq undo-extra-outer-limit (+ size 50000)) 2797 (setq undo-extra-outer-limit (+ size 50000))
2798 (if (let (use-dialog-box track-mouse executing-kbd-macro ) 2798 (if (let (use-dialog-box track-mouse executing-kbd-macro )
2799 (yes-or-no-p (format "Buffer ‘%s’ undo info is %d bytes long; discard it? " 2799 (yes-or-no-p (format-message
2800 (buffer-name) size))) 2800 "Buffer ‘%s’ undo info is %d bytes long; discard it? "
2801 (buffer-name) size)))
2801 (progn (setq buffer-undo-list nil) 2802 (progn (setq buffer-undo-list nil)
2802 (setq undo-extra-outer-limit nil) 2803 (setq undo-extra-outer-limit nil)
2803 t) 2804 t)
2804 nil)) 2805 nil))
2805 (display-warning '(undo discard-info) 2806 (display-warning '(undo discard-info)
2806 (concat 2807 (concat
2807 (format "Buffer ‘%s’ undo info was %d bytes long.\n" 2808 (format-message
2808 (buffer-name) size) 2809 "Buffer ‘%s’ undo info was %d bytes long.\n"
2810 (buffer-name) size)
2809 "The undo info was discarded because it exceeded \ 2811 "The undo info was discarded because it exceeded \
2810`undo-outer-limit'. 2812`undo-outer-limit'.
2811 2813
@@ -8326,8 +8328,9 @@ contains the list of implementations currently supported for this command."
8326 (interactive "P") 8328 (interactive "P")
8327 (when (or arg (null ,varimp-sym)) 8329 (when (or arg (null ,varimp-sym))
8328 (let ((val (completing-read 8330 (let ((val (completing-read
8329 ,(format "Select implementation for command ‘%s’: " 8331 ,(format-message
8330 command-name) 8332 "Select implementation for command ‘%s’: "
8333 command-name)
8331 ,varalt-sym nil t))) 8334 ,varalt-sym nil t)))
8332 (unless (string-equal val "") 8335 (unless (string-equal val "")
8333 (when (null ,varimp-sym) 8336 (when (null ,varimp-sym)
@@ -8339,8 +8342,9 @@ contains the list of implementations currently supported for this command."
8339 (cdr (assoc-string val ,varalt-sym)))))) 8342 (cdr (assoc-string val ,varalt-sym))))))
8340 (if ,varimp-sym 8343 (if ,varimp-sym
8341 (call-interactively ,varimp-sym) 8344 (call-interactively ,varimp-sym)
8342 (message ,(format "No implementation selected for command ‘%s’" 8345 (message "%s" ,(format-message
8343 command-name))))))) 8346 "No implementation selected for command ‘%s’"
8347 command-name)))))))
8344 8348
8345 8349
8346 8350
diff --git a/lisp/startup.el b/lisp/startup.el
index ec159c2264b..2d1bcc9f424 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1177,7 +1177,8 @@ please check its value")
1177 (error 1177 (error
1178 (display-warning 1178 (display-warning
1179 'initialization 1179 'initialization
1180 (format "An error occurred while loading ‘%s’:\n\n%s%s%s\n\n\ 1180 (format-message "\
1181An error occurred while loading ‘%s’:\n\n%s%s%s\n\n\
1181To ensure normal operation, you should investigate and remove the 1182To ensure normal operation, you should investigate and remove the
1182cause of the error in your initialization file. Start Emacs with 1183cause of the error in your initialization file. Start Emacs with
1183the ‘--debug-init’ option to view a complete error backtrace." 1184the ‘--debug-init’ option to view a complete error backtrace."
@@ -1312,7 +1313,8 @@ the ‘--debug-init’ option to view a complete error backtrace."
1312 (expand-file-name user-emacs-directory)) 1313 (expand-file-name user-emacs-directory))
1313 (setq warned t) 1314 (setq warned t)
1314 (display-warning 'initialization 1315 (display-warning 'initialization
1315 (format "Your ‘load-path’ seems to contain 1316 (format-message "\
1317Your ‘load-path’ seems to contain\n\
1316your ‘.emacs.d’ directory: %s\n\ 1318your ‘.emacs.d’ directory: %s\n\
1317This is likely to cause problems...\n\ 1319This is likely to cause problems...\n\
1318Consider using a subdirectory instead, e.g.: %s" 1320Consider using a subdirectory instead, e.g.: %s"
diff --git a/lisp/subr.el b/lisp/subr.el
index 7e7dbd145a6..6d99c6cdc76 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -288,6 +288,12 @@ This function accepts any number of arguments, but ignores them."
288 (interactive) 288 (interactive)
289 nil) 289 nil)
290 290
291(defun format-message (format-string &rest args)
292 "Format a string out of FORMAT-STRING and arguments.
293This is like ‘format’, except it also converts curved quotes in
294FORMAT-STRING as per ‘text-quoting-style’."
295 (apply #'format (internal--text-restyle format-string) args))
296
291;; Signal a compile-error if the first arg is missing. 297;; Signal a compile-error if the first arg is missing.
292(defun error (&rest args) 298(defun error (&rest args)
293 "Signal an error, making error message by passing all args to `format'. 299 "Signal an error, making error message by passing all args to `format'.
@@ -295,7 +301,7 @@ In Emacs, the convention is that error messages start with a capital
295letter but *do not* end with a period. Please follow this convention 301letter but *do not* end with a period. Please follow this convention
296for the sake of consistency." 302for the sake of consistency."
297 (declare (advertised-calling-convention (string &rest args) "23.1")) 303 (declare (advertised-calling-convention (string &rest args) "23.1"))
298 (signal 'error (list (apply 'format args)))) 304 (signal 'error (list (apply #'format-message args))))
299 305
300(defun user-error (format &rest args) 306(defun user-error (format &rest args)
301 "Signal a pilot error, making error message by passing all args to `format'. 307 "Signal a pilot error, making error message by passing all args to `format'.
@@ -305,7 +311,7 @@ for the sake of consistency.
305This is just like `error' except that `user-error's are expected to be the 311This is just like `error' except that `user-error's are expected to be the
306result of an incorrect manipulation on the part of the user, rather than the 312result of an incorrect manipulation on the part of the user, rather than the
307result of an actual problem." 313result of an actual problem."
308 (signal 'user-error (list (apply #'format format args)))) 314 (signal 'user-error (list (apply #'format-message format args))))
309 315
310(defun define-error (name message &optional parent) 316(defun define-error (name message &optional parent)
311 "Define NAME as a new error signal. 317 "Define NAME as a new error signal.
@@ -1606,8 +1612,9 @@ can do the job."
1606 exp 1612 exp
1607 (let* ((sym (cadr list-var)) 1613 (let* ((sym (cadr list-var))
1608 (append (eval append)) 1614 (append (eval append))
1609 (msg (format "‘add-to-list’ can't use lexical var ‘%s’; use ‘push’ or ‘cl-pushnew’" 1615 (msg (format-message
1610 sym)) 1616 "‘add-to-list’ can't use lexical var ‘%s’; use ‘push’ or ‘cl-pushnew’"
1617 sym))
1611 ;; Big ugly hack so we only output a warning during 1618 ;; Big ugly hack so we only output a warning during
1612 ;; byte-compilation, and so we can use 1619 ;; byte-compilation, and so we can use
1613 ;; byte-compile-not-lexical-var-p to silence the warning 1620 ;; byte-compile-not-lexical-var-p to silence the warning
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 9fea3162810..e9095b3b41b 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -141,12 +141,13 @@ options:
141 db)) 141 db))
142 (insert "However, your customizations have " 142 (insert "However, your customizations have "
143 (if cb 143 (if cb
144 (format "rebound it to the command ‘%s’" cb) 144 (format-message "rebound it to the command ‘%s’" cb)
145 "unbound it")) 145 "unbound it"))
146 (insert ".") 146 (insert ".")
147 (when mapsym 147 (when mapsym
148 (insert " (For the more advanced user:" 148 (insert " (For the more advanced user:"
149 (format " This binding is in the keymap ‘%s’.)" mapsym))) 149 (format-message
150 " This binding is in the keymap ‘%s’.)" mapsym)))
150 (if (string= where "") 151 (if (string= where "")
151 (unless (keymapp db) 152 (unless (keymapp db)
152 (insert "\n\nYou can use M-x " 153 (insert "\n\nYou can use M-x "
@@ -158,7 +159,7 @@ options:
158 "" 159 ""
159 "the key") 160 "the key")
160 where 161 where
161 (format " to get the function ‘%s’." db)))) 162 (format-message " to get the function ‘%s’." db))))
162 (fill-region (point-min) (point))))) 163 (fill-region (point-min) (point)))))
163 (help-print-return-message)))) 164 (help-print-return-message))))
164 165
@@ -450,7 +451,7 @@ where
450 (lookup-key global-map 451 (lookup-key global-map
451 [menu-bar])))) 452 [menu-bar]))))
452 (stringp cwhere)) 453 (stringp cwhere))
453 (format "the ‘%s’ menu" cwhere) 454 (format-message "the ‘%s’ menu" cwhere)
454 "the menus")))) 455 "the menus"))))
455 (setq where "")) 456 (setq where ""))
456 (setq remark nil) 457 (setq remark nil)
diff --git a/src/callint.c b/src/callint.c
index 2ff2f80d740..be0fb1a84df 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -511,6 +511,7 @@ invoke it. If KEYS is omitted or nil, the return value of
511 for (i = 2; *tem; i++) 511 for (i = 2; *tem; i++)
512 { 512 {
513 visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n")); 513 visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n"));
514 visargs[1] = Finternal__text_restyle (visargs[1]);
514 if (strchr (SSDATA (visargs[1]), '%')) 515 if (strchr (SSDATA (visargs[1]), '%'))
515 callint_message = Fformat (i - 1, visargs + 1); 516 callint_message = Fformat (i - 1, visargs + 1);
516 else 517 else
diff --git a/src/doc.c b/src/doc.c
index f871ac75b59..3c8b11d73f3 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -1028,6 +1028,67 @@ Otherwise, return a new string. */)
1028 xfree (buf); 1028 xfree (buf);
1029 RETURN_UNGCPRO (tem); 1029 RETURN_UNGCPRO (tem);
1030} 1030}
1031
1032DEFUN ("internal--text-restyle", Finternal__text_restyle,
1033 Sinternal__text_restyle, 1, 1, 0,
1034 doc: /* Return STRING, possibly substituting quote characters.
1035
1036In the result, replace each curved single quote (\\=‘ and \\=’) by
1037left and right quote characters as specified by ‘text-quoting-style’.
1038
1039Return the original STRING in the common case where no changes are needed.
1040Otherwise, return a new string. */)
1041 (Lisp_Object string)
1042{
1043 bool changed = false;
1044
1045 CHECK_STRING (string);
1046 if (! STRING_MULTIBYTE (string))
1047 return string;
1048
1049 enum text_quoting_style quoting_style = text_quoting_style ();
1050 if (quoting_style == CURVE_QUOTING_STYLE)
1051 return string;
1052
1053 ptrdiff_t bsize = SBYTES (string);
1054 unsigned char const *strp = SDATA (string);
1055 unsigned char const *strlim = strp + bsize;
1056 USE_SAFE_ALLOCA;
1057 char *buf = SAFE_ALLOCA (bsize);
1058 char *bufp = buf;
1059 ptrdiff_t nchars = 0;
1060
1061 while (strp < strlim)
1062 {
1063 unsigned char const *cp = strp;
1064 switch (STRING_CHAR_ADVANCE (strp))
1065 {
1066 case LEFT_SINGLE_QUOTATION_MARK:
1067 *bufp++ = quoting_style == GRAVE_QUOTING_STYLE ? '`': '\'';
1068 changed = true;
1069 break;
1070
1071 case RIGHT_SINGLE_QUOTATION_MARK:
1072 *bufp++ = '\'';
1073 changed = true;
1074 break;
1075
1076 default:
1077 do
1078 *bufp++ = *cp++;
1079 while (cp != strp);
1080
1081 break;
1082 }
1083
1084 nchars++;
1085 }
1086
1087 Lisp_Object result
1088 = changed ? make_string_from_bytes (buf, nchars, bufp - buf) : string;
1089 SAFE_FREE ();
1090 return result;
1091}
1031 1092
1032void 1093void
1033syms_of_doc (void) 1094syms_of_doc (void)
@@ -1061,4 +1122,5 @@ displayable, and like ‘grave’ otherwise. */);
1061 defsubr (&Sdocumentation_property); 1122 defsubr (&Sdocumentation_property);
1062 defsubr (&Ssnarf_documentation); 1123 defsubr (&Ssnarf_documentation);
1063 defsubr (&Ssubstitute_command_keys); 1124 defsubr (&Ssubstitute_command_keys);
1125 defsubr (&Sinternal__text_restyle);
1064} 1126}
diff --git a/src/editfns.c b/src/editfns.c
index 8ac0ef16999..da7d554fd94 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3696,8 +3696,8 @@ usage: (message FORMAT-STRING &rest ARGS) */)
3696 } 3696 }
3697 else 3697 else
3698 { 3698 {
3699 register Lisp_Object val; 3699 args[0] = Finternal__text_restyle (args[0]);
3700 val = Fformat (nargs, args); 3700 Lisp_Object val = Fformat (nargs, args);
3701 message3 (val); 3701 message3 (val);
3702 return val; 3702 return val;
3703 } 3703 }
@@ -3722,6 +3722,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */)
3722 } 3722 }
3723 else 3723 else
3724 { 3724 {
3725 args[0] = Finternal__text_restyle (args[0]);
3725 Lisp_Object val = Fformat (nargs, args); 3726 Lisp_Object val = Fformat (nargs, args);
3726 Lisp_Object pane, menu; 3727 Lisp_Object pane, menu;
3727 struct gcpro gcpro1; 3728 struct gcpro gcpro1;