[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0026d0b: Don't keep warning about unescaped literal
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master 0026d0b: Don't keep warning about unescaped literals (Bug#36068) |
Date: |
Mon, 10 Jun 2019 18:40:42 -0400 (EDT) |
branch: master
commit 0026d0bf9f4e4e0247de9c1eb885507608378266
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Don't keep warning about unescaped literals (Bug#36068)
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Restore lost
let-binding of lread--unescaped-character-literals, so that unescaped
literals warning will only apply to the form just read.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--unescaped-char-literals): Expand test to check that
we don't keep warning about old unescaped literals.
---
lisp/emacs-lisp/bytecomp.el | 5 +++--
test/lisp/emacs-lisp/bytecomp-tests.el | 32 +++++++++++++++++++-------------
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 38cce14..f2a38a9 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2093,8 +2093,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 ((form (read inbuffer))
- (warning (byte-run--unescaped-character-literals-warning)))
+ (let* ((lread--unescaped-character-literals nil)
+ (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.
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el
b/test/lisp/emacs-lisp/bytecomp-tests.el
index f45c920..83162d2 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -559,19 +559,25 @@ bytecompiled code, and their results compared.")
"Check that byte compiling warns about unescaped character
literals (Bug#20852)."
(should (boundp 'lread--unescaped-character-literals))
- (bytecomp-tests--with-temp-file source
- (write-region "(list ?) ?( ?; ?\" ?[ ?])" nil source)
- (bytecomp-tests--with-temp-file destination
- (let* ((byte-compile-dest-file-function (lambda (_) destination))
- (byte-compile-error-on-warn t)
- (byte-compile-debug t)
- (err (should-error (byte-compile-file source))))
- (should (equal (cdr err)
- (list (concat "unescaped character literals "
- "`?\"', `?(', `?)', `?;', `?[', `?]' "
- "detected, "
- "`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[',
"
- "`?\\]' expected!"))))))))
+ (let ((byte-compile-error-on-warn t)
+ (byte-compile-debug t))
+ (bytecomp-tests--with-temp-file source
+ (write-region "(list ?) ?( ?; ?\" ?[ ?])" nil source)
+ (bytecomp-tests--with-temp-file destination
+ (let* ((byte-compile-dest-file-function (lambda (_) destination))
+ (err (should-error (byte-compile-file source))))
+ (should (equal (cdr err)
+ `(,(concat "unescaped character literals "
+ "`?\"', `?(', `?)', `?;', `?[', `?]' "
+ "detected, "
+ "`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', "
+ "`?\\]' expected!")))))))
+ ;; But don't warn in subsequent compilations (Bug#36068).
+ (bytecomp-tests--with-temp-file source
+ (write-region "(list 1 2 3)" nil source)
+ (bytecomp-tests--with-temp-file destination
+ (let ((byte-compile-dest-file-function (lambda (_) destination)))
+ (should (byte-compile-file source)))))))
(ert-deftest bytecomp-tests--old-style-backquotes ()
"Check that byte compiling warns about old-style backquotes."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 0026d0b: Don't keep warning about unescaped literals (Bug#36068),
Noam Postavsky <=