diff options
| author | Philipp Stephani | 2017-12-29 21:58:07 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2018-01-07 14:25:12 +0100 |
| commit | 378be8df8d9075719437c475fbb520dd40d2353b (patch) | |
| tree | 676bd7222c3ebadecc1eef44a00d1aab61523007 | |
| parent | ddb74b2027802ab4416bd8cdb1757a209dd7a63b (diff) | |
| download | emacs-378be8df8d9075719437c475fbb520dd40d2353b.tar.gz emacs-378be8df8d9075719437c475fbb520dd40d2353b.zip | |
Improve error message for old-style backquotes
* src/lread.c (load_error_old_style_backquotes): Improve error message
if no file is being loaded.
* test/src/lread-tests.el (lread-tests--force-new-style-backquotes):
Adapt test.
| -rw-r--r-- | src/lread.c | 12 | ||||
| -rw-r--r-- | test/src/lread-tests.el | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/lread.c b/src/lread.c index d675b563916..bcf3b7f55c7 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1006,8 +1006,16 @@ load_error_handler (Lisp_Object data) | |||
| 1006 | static _Noreturn void | 1006 | static _Noreturn void |
| 1007 | load_error_old_style_backquotes (void) | 1007 | load_error_old_style_backquotes (void) |
| 1008 | { | 1008 | { |
| 1009 | AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); | 1009 | if (NILP (Vload_file_name)) |
| 1010 | xsignal1 (Qerror, CALLN (Fformat_message, format, Vload_file_name)); | 1010 | { |
| 1011 | AUTO_STRING (message, "Old-style backquotes detected!"); | ||
| 1012 | xsignal1 (Qerror, message); | ||
| 1013 | } | ||
| 1014 | else | ||
| 1015 | { | ||
| 1016 | AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); | ||
| 1017 | xsignal1 (Qerror, CALLN (Fformat_message, format, Vload_file_name)); | ||
| 1018 | } | ||
| 1011 | } | 1019 | } |
| 1012 | 1020 | ||
| 1013 | static void | 1021 | static void |
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 693c6c09bf3..daf53438811 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -183,8 +183,7 @@ literals (Bug#20852)." | |||
| 183 | 183 | ||
| 184 | (ert-deftest lread-tests--force-new-style-backquotes () | 184 | (ert-deftest lread-tests--force-new-style-backquotes () |
| 185 | (let ((data (should-error (read "(` (a b))")))) | 185 | (let ((data (should-error (read "(` (a b))")))) |
| 186 | (should (equal (cdr data) | 186 | (should (equal (cdr data) '("Old-style backquotes detected!")))) |
| 187 | '("Loading `nil': old-style backquotes detected!")))) | ||
| 188 | (should (equal (let ((force-new-style-backquotes t)) | 187 | (should (equal (let ((force-new-style-backquotes t)) |
| 189 | (read "(` (a b))")) | 188 | (read "(` (a b))")) |
| 190 | '(`(a b))))) | 189 | '(`(a b))))) |