* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! @ 2019-06-03 2:14 Michael Heerdegen 2019-06-03 12:06 ` Noam Postavsky 0 siblings, 1 reply; 11+ messages in thread From: Michael Heerdegen @ 2019-06-03 2:14 UTC (permalink / raw) To: 36068 Hello, Sometimes, out of nowhere, when I byte compile my init file (with my config loaded of course), I get hundreds (!) of warnings .gnu-emacs.el:22:1:Warning: unescaped character literals `?)' detected, `?\)' expected! Dunno if it happens when there is a syntax error in the file, or just Heisenbug like. When this has happened once, I cannot get back to a normal compilation, compiling any Elisp file gives me the above warnings. I have to restart Emacs. Then everything is good. I have still open such an ill session, maybe it can help with the diagnosis? TIA, Michael. In GNU Emacs 27.0.50 (build 19, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2019-06-03 built on drachen Repository revision: ae7e0657b20037eb386aa21a35f05bcb4c283611 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12003000 System Description: Debian GNU/Linux 10 (buster) Recent messages: Saving /home/micha/gnu-emacs/.newsrc.eld... Saving file /home/micha/gnu-emacs/.newsrc.eld... Wrote /home/micha/gnu-emacs/.newsrc.eld Saving /home/micha/gnu-emacs/.newsrc.eld...done Sending... Sending via mail... Sending email Sending email done Sending...done Making completion list... [10 times] ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 2:14 bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! Michael Heerdegen @ 2019-06-03 12:06 ` Noam Postavsky 2019-06-03 13:16 ` Michael Heerdegen 0 siblings, 1 reply; 11+ messages in thread From: Noam Postavsky @ 2019-06-03 12:06 UTC (permalink / raw) To: Michael Heerdegen; +Cc: 36068 Michael Heerdegen <michael_heerdegen@web.de> writes: > Sometimes, out of nowhere, when I byte compile my init file (with my > config loaded of course), I get hundreds (!) of warnings > > .gnu-emacs.el:22:1:Warning: unescaped character literals `?)' detected, `?\)' > expected! > > Dunno if it happens when there is a syntax error in the file, or just > Heisenbug like. When this has happened once, I cannot get back to a > normal compilation, compiling any Elisp file gives me the above > warnings. I have to restart Emacs. Then everything is good. > > I have still open such an ill session, maybe it can help with the > diagnosis? Hmm, is lread--unescaped-character-literals non-nil? It looks like the variable can only get cleared due to the let-binding in load, so if it somehow got set outside of that, then you would see continual warnings from it. ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 12:06 ` Noam Postavsky @ 2019-06-03 13:16 ` Michael Heerdegen 2019-06-03 13:50 ` npostavs 0 siblings, 1 reply; 11+ messages in thread From: Michael Heerdegen @ 2019-06-03 13:16 UTC (permalink / raw) To: Noam Postavsky; +Cc: 36068 Noam Postavsky <npostavs@gmail.com> writes: > Hmm, is lread--unescaped-character-literals non-nil? It looks like > the variable can only get cleared due to the let-binding in load, so > if it somehow got set outside of that, then you would see continual > warnings from it. Yes, its value is (41). Michael. ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 13:16 ` Michael Heerdegen @ 2019-06-03 13:50 ` npostavs 2019-06-03 14:34 ` Michael Heerdegen ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: npostavs @ 2019-06-03 13:50 UTC (permalink / raw) To: Michael Heerdegen; +Cc: 36068, Noam Postavsky tags 36068 + confirmed quit Michael Heerdegen <michael_heerdegen@web.de> writes: > Noam Postavsky <npostavs@gmail.com> writes: > >> Hmm, is lread--unescaped-character-literals non-nil? It looks like >> the variable can only get cleared due to the let-binding in load, so >> if it somehow got set outside of that, then you would see continual >> warnings from it. > > Yes, its value is (41). Ah, I think the problem can be triggered any time you `read' an unescaped literal outside of `load'. E.g., from emacs -Q: M-: (read "?)") RET or even just M-: ?) RET Now any byte-compilation will report unescaped `?)'. You can (setq lread--unescaped-character-literals nil) to stop it. ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 13:50 ` npostavs @ 2019-06-03 14:34 ` Michael Heerdegen 2019-06-03 14:51 ` Eli Zaretskii 2019-06-03 17:18 ` Andreas Schwab 2 siblings, 0 replies; 11+ messages in thread From: Michael Heerdegen @ 2019-06-03 14:34 UTC (permalink / raw) To: npostavs; +Cc: 36068 npostavs@gmail.com writes: > Ah, I think the problem can be triggered any time you `read' an unescaped > literal outside of `load'. E.g., from emacs -Q: > > M-: (read "?)") RET > > or even just > > M-: ?) RET > > Now any byte-compilation will report unescaped `?)'. You can > > (setq lread--unescaped-character-literals nil) > > to stop it. I can confirm all of that. I use `read' quite often through el-search, also through an experimental el-search-hi-lock mode, so that might explain why I might see the problem more often than others. Michael. ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 13:50 ` npostavs 2019-06-03 14:34 ` Michael Heerdegen @ 2019-06-03 14:51 ` Eli Zaretskii 2019-06-03 17:04 ` Andreas Schwab 2019-06-03 17:18 ` Andreas Schwab 2 siblings, 1 reply; 11+ messages in thread From: Eli Zaretskii @ 2019-06-03 14:51 UTC (permalink / raw) To: npostavs; +Cc: michael_heerdegen, 36068, npostavs > From: npostavs@gmail.com > Date: Mon, 03 Jun 2019 09:50:47 -0400 > Cc: 36068@debbugs.gnu.org, Noam Postavsky <npostavs@gmail.com> > > Ah, I think the problem can be triggered any time you `read' an unescaped > literal outside of `load'. E.g., from emacs -Q: > > M-: (read "?)") RET > > or even just > > M-: ?) RET > > Now any byte-compilation will report unescaped `?)'. Maybe we should forcefully set it to nil at top level? ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 14:51 ` Eli Zaretskii @ 2019-06-03 17:04 ` Andreas Schwab 2019-06-03 17:14 ` npostavs 0 siblings, 1 reply; 11+ messages in thread From: Andreas Schwab @ 2019-06-03 17:04 UTC (permalink / raw) To: Eli Zaretskii; +Cc: michael_heerdegen, 36068, npostavs On Jun 03 2019, Eli Zaretskii <eliz@gnu.org> wrote: >> From: npostavs@gmail.com >> Date: Mon, 03 Jun 2019 09:50:47 -0400 >> Cc: 36068@debbugs.gnu.org, Noam Postavsky <npostavs@gmail.com> >> >> Ah, I think the problem can be triggered any time you `read' an unescaped >> literal outside of `load'. E.g., from emacs -Q: >> >> M-: (read "?)") RET >> >> or even just >> >> M-: ?) RET >> >> Now any byte-compilation will report unescaped `?)'. > > Maybe we should forcefully set it to nil at top level? But how can load_warn_unescaped_character_literals be called while lread--unescaped-character-literals is not let-bound? Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 17:04 ` Andreas Schwab @ 2019-06-03 17:14 ` npostavs 0 siblings, 0 replies; 11+ messages in thread From: npostavs @ 2019-06-03 17:14 UTC (permalink / raw) To: Andreas Schwab; +Cc: michael_heerdegen, 36068, npostavs Andreas Schwab <schwab@linux-m68k.org> writes: > On Jun 03 2019, Eli Zaretskii <eliz@gnu.org> wrote: > >>> From: npostavs@gmail.com >>> Ah, I think the problem can be triggered any time you `read' an unescaped >>> literal outside of `load'. E.g., from emacs -Q: >>> M-: ?) RET >>> >>> Now any byte-compilation will report unescaped `?)'. >> >> Maybe we should forcefully set it to nil at top level? > > But how can load_warn_unescaped_character_literals be called while > lread--unescaped-character-literals is not let-bound? It's not. byte-run--unescaped-character-literals-warning is called from the byte compiler. So maybe just let-binding lread--unescaped-character-literals in byte-compile-from-buffer should be enough. ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 13:50 ` npostavs 2019-06-03 14:34 ` Michael Heerdegen 2019-06-03 14:51 ` Eli Zaretskii @ 2019-06-03 17:18 ` Andreas Schwab 2019-06-05 1:29 ` Noam Postavsky 2 siblings, 1 reply; 11+ messages in thread From: Andreas Schwab @ 2019-06-03 17:18 UTC (permalink / raw) To: npostavs; +Cc: Michael Heerdegen, 36068 On Jun 03 2019, npostavs@gmail.com wrote: > tags 36068 + confirmed > quit > > Michael Heerdegen <michael_heerdegen@web.de> writes: > >> Noam Postavsky <npostavs@gmail.com> writes: >> >>> Hmm, is lread--unescaped-character-literals non-nil? It looks like >>> the variable can only get cleared due to the let-binding in load, so >>> if it somehow got set outside of that, then you would see continual >>> warnings from it. >> >> Yes, its value is (41). > > Ah, I think the problem can be triggered any time you `read' an unescaped > literal outside of `load'. E.g., from emacs -Q: > > M-: (read "?)") RET > > or even just > > M-: ?) RET Even byte-compiling a file containing such an unescaped literal sets lread--unescaped-character-literals in the global scope. I think this is where the real bug is. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." ^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-03 17:18 ` Andreas Schwab @ 2019-06-05 1:29 ` Noam Postavsky 2019-06-10 22:41 ` Noam Postavsky 0 siblings, 1 reply; 11+ messages in thread From: Noam Postavsky @ 2019-06-05 1:29 UTC (permalink / raw) To: Andreas Schwab; +Cc: Michael Heerdegen, 36068 [-- Attachment #1: Type: text/plain, Size: 390 bytes --] tags 36068 + patch quit >> Ah, I think the problem can be triggered any time you `read' an unescaped >> literal outside of `load'. E.g., from emacs -Q: >> >> M-: (read "?)") RET > > Even byte-compiling a file containing such an unescaped literal sets > lread--unescaped-character-literals in the global scope. I think this > is where the real bug is. Yes, agreed. Here's a patch. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: patch --] [-- Type: text/x-diff, Size: 3965 bytes --] From ffa9c9e17bd6724107b6c3b5c49221b58d7c92ab Mon Sep 17 00:00:00 2001 From: Noam Postavsky <npostavs@gmail.com> Date: Tue, 4 Jun 2019 21:26:06 -0400 Subject: [PATCH] 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 dfbda8d43e..f8a5c264ab 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2091,8 +2091,9 @@ (defun byte-compile-from-buffer (inbuffer) (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 f45c9209c1..83162d250f 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -559,19 +559,25 @@ (ert-deftest bytecomp-tests--unescaped-char-literals () "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." -- 2.11.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! 2019-06-05 1:29 ` Noam Postavsky @ 2019-06-10 22:41 ` Noam Postavsky 0 siblings, 0 replies; 11+ messages in thread From: Noam Postavsky @ 2019-06-10 22:41 UTC (permalink / raw) To: Andreas Schwab; +Cc: Michael Heerdegen, 36068 tags 36068 fixed close 36068 quit >> Even byte-compiling a file containing such an unescaped literal sets >> lread--unescaped-character-literals in the global scope. I think this >> is where the real bug is. > > Yes, agreed. Here's a patch. Pushed to master. 0026d0bf9f 2019-06-10T18:27:22-04:00 "Don't keep warning about unescaped literals (Bug#36068)" https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0026d0bf9f4e4e0247de9c1eb885507608378266 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-06-10 22:41 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-06-03 2:14 bug#36068: 27.0.50; Warning: unescaped character literals `?)' detected, `?\)' expected! Michael Heerdegen 2019-06-03 12:06 ` Noam Postavsky 2019-06-03 13:16 ` Michael Heerdegen 2019-06-03 13:50 ` npostavs 2019-06-03 14:34 ` Michael Heerdegen 2019-06-03 14:51 ` Eli Zaretskii 2019-06-03 17:04 ` Andreas Schwab 2019-06-03 17:14 ` npostavs 2019-06-03 17:18 ` Andreas Schwab 2019-06-05 1:29 ` Noam Postavsky 2019-06-10 22:41 ` Noam Postavsky
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).