diff options
| author | Philipp Stephani | 2015-06-30 22:38:35 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-05-01 20:39:10 +0200 |
| commit | c2bbdc3316487e34eba1470dd059c0c290431e00 (patch) | |
| tree | bed5315e69d89c99c62be4a78e8f26d799643f70 /lisp | |
| parent | b72e36047c9a5d46b02e12252e0fc640b6839903 (diff) | |
| download | emacs-c2bbdc3316487e34eba1470dd059c0c290431e00.tar.gz emacs-c2bbdc3316487e34eba1470dd059c0c290431e00.zip | |
Warn about missing backslashes during load
* src/lread.c (load_warn_unescaped_character_literals, Fload, read1)
(syms_of_lread): Warn if unescaped character literals are
found (Bug#20152).
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Check for
unescaped character literals during byte compilation.
* test/src/lread-tests.el (lread-tests--unescaped-char-literals): New
unit test.
(lread-tests--with-temp-file, lread-tests--last-message): Helper
functions for unit test.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--unescaped-char-literals): New unit test.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--with-temp-file):
Helper macro for unit test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 15dc24060aa..25102548a9d 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -2027,12 +2027,19 @@ With argument ARG, insert value in current buffer after the form." | |||
| 2027 | (setq byte-compile-read-position (point) | 2027 | (setq byte-compile-read-position (point) |
| 2028 | byte-compile-last-position byte-compile-read-position) | 2028 | byte-compile-last-position byte-compile-read-position) |
| 2029 | (let* ((old-style-backquotes nil) | 2029 | (let* ((old-style-backquotes nil) |
| 2030 | (lread--unescaped-character-literals nil) | ||
| 2030 | (form (read inbuffer))) | 2031 | (form (read inbuffer))) |
| 2031 | ;; Warn about the use of old-style backquotes. | 2032 | ;; Warn about the use of old-style backquotes. |
| 2032 | (when old-style-backquotes | 2033 | (when old-style-backquotes |
| 2033 | (byte-compile-warn "!! The file uses old-style backquotes !! | 2034 | (byte-compile-warn "!! The file uses old-style backquotes !! |
| 2034 | This functionality has been obsolete for more than 10 years already | 2035 | This functionality has been obsolete for more than 10 years already |
| 2035 | and will be removed soon. See (elisp)Backquote in the manual.")) | 2036 | and will be removed soon. See (elisp)Backquote in the manual.")) |
| 2037 | (when lread--unescaped-character-literals | ||
| 2038 | (byte-compile-warn | ||
| 2039 | "unescaped character literals %s detected!" | ||
| 2040 | (mapconcat #'string | ||
| 2041 | (sort lread--unescaped-character-literals #'<) | ||
| 2042 | ", "))) | ||
| 2036 | (byte-compile-toplevel-file-form form))) | 2043 | (byte-compile-toplevel-file-form form))) |
| 2037 | ;; Compile pending forms at end of file. | 2044 | ;; Compile pending forms at end of file. |
| 2038 | (byte-compile-flush-pending) | 2045 | (byte-compile-flush-pending) |