Styled quotes in compiler warnings

* lisp/emacs-lisp/byte-run.el (byte-run--parse-body)
(byte-run--unescaped-character-literals-warning):
* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment)
(byte-compile-form, bytecomp--warn-dodgy-eq-arg):
* lisp/emacs-lisp/cconv.el (cconv--warn-unused-msg):
* lisp/emacs-lisp/cl-macs.el (cl-defstruct):
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode):
* lisp/emacs-lisp/eieio.el (defclass):
* lisp/emacs-lisp/macroexp.el (macroexp--unfold-lambda)
(macroexp--expand-all):
* lisp/emacs-lisp/pcase.el (pcase--u1):
* lisp/subr.el (when, unless, ignore-error, lsh, sit-for)
(with-demoted-errors):
Use format-message to ensure properly styled quotes in compiler
warning messages.
This commit is contained in:
Mattias Engdegård 2023-01-03 15:58:14 +01:00
parent cfc0e1cc02
commit 0e1b03bbb8
9 changed files with 46 additions and 37 deletions

View file

@ -262,7 +262,8 @@ This is used by `declare'.")
(interactive-form nil)
(warnings nil)
(warn #'(lambda (msg form)
(push (macroexp-warn-and-return msg nil nil t form)
(push (macroexp-warn-and-return
(format-message msg) nil nil t form)
warnings))))
(while
(and body
@ -679,11 +680,11 @@ Otherwise, return nil. For internal use only."
;; This is called from lread.c and therefore needs to be preloaded.
(if lread--unescaped-character-literals
(let ((sorted (sort lread--unescaped-character-literals #'<)))
(format-message "unescaped character literals %s detected, %s expected!"
(mapconcat (lambda (char) (format "`?%c'" char))
sorted ", ")
(mapconcat (lambda (char) (format "`?\\%c'" char))
sorted ", ")))))
(format "unescaped character literals %s detected, %s expected!"
(mapconcat (lambda (char) (format-message "`?%c'" char))
sorted ", ")
(mapconcat (lambda (char) (format-message "`?\\%c'" char))
sorted ", ")))))
(defun byte-compile-info (string &optional message type)
"Format STRING in a way that looks pleasing in the compilation output.