mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 06:20:43 -08:00
Make warning about unescaped character literals more helpful.
See Bug#31676. * lisp/emacs-lisp/byte-run.el (byte-run--unescaped-character-literals-warning): New defun. * src/lread.c (load_warn_unescaped_character_literals): Use new defun. (syms_of_lread): Define symbol for new defun. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Use new defun. * test/src/lread-tests.el (lread-tests--unescaped-char-literals): test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals): Adapt unit tests.
This commit is contained in:
parent
8aadf6e415
commit
0b4b380ce4
5 changed files with 33 additions and 25 deletions
|
|
@ -2082,14 +2082,9 @@ With argument ARG, insert value in current buffer after the form."
|
|||
(not (eobp)))
|
||||
(setq byte-compile-read-position (point)
|
||||
byte-compile-last-position byte-compile-read-position)
|
||||
(let* ((lread--unescaped-character-literals nil)
|
||||
(form (read inbuffer)))
|
||||
(when lread--unescaped-character-literals
|
||||
(byte-compile-warn
|
||||
"unescaped character literals %s detected!"
|
||||
(mapconcat (lambda (char) (format "`?%c'" char))
|
||||
(sort lread--unescaped-character-literals #'<)
|
||||
", ")))
|
||||
(let ((form (read inbuffer))
|
||||
(warning (byte-run--unescaped-character-literals-warning)))
|
||||
(when warning (byte-compile-warn "%s" warning))
|
||||
(byte-compile-toplevel-file-form form)))
|
||||
;; Compile pending forms at end of file.
|
||||
(byte-compile-flush-pending)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue