aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhilipp Stephani2017-12-29 21:50:55 +0100
committerPhilipp Stephani2018-01-07 14:16:02 +0100
commitddb74b2027802ab4416bd8cdb1757a209dd7a63b (patch)
tree938556910293db86bd2b074bba9a292339f6ce70 /src
parent610dad1102cba5fa6111050d30c734b51bcdb77d (diff)
downloademacs-ddb74b2027802ab4416bd8cdb1757a209dd7a63b.tar.gz
emacs-ddb74b2027802ab4416bd8cdb1757a209dd7a63b.zip
Add new variable to force new-style backquote interpretation.
* src/lread.c (syms_of_lread): Add new variable 'force-new-style-backquotes'. (read_internal_start): Use it. * test/src/lread-tests.el (lread-tests--force-new-style-backquotes): New test. * etc/NEWS: Document new variable.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/lread.c b/src/lread.c
index da40e99a5e6..d675b563916 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -147,10 +147,10 @@ static ptrdiff_t prev_saved_doc_string_length;
147/* This is the file position that string came from. */ 147/* This is the file position that string came from. */
148static file_offset prev_saved_doc_string_position; 148static file_offset prev_saved_doc_string_position;
149 149
150/* True means inside a new-style backquote 150/* True means inside a new-style backquote with no surrounding
151 with no surrounding parentheses. 151 parentheses. Fread initializes this to the value of
152 Fread initializes this to false, so we need not specbind it 152 `force_new_style_backquotes', so we need not specbind it or worry
153 or worry about what happens to it when there is an error. */ 153 about what happens to it when there is an error. */
154static bool new_backquote_flag; 154static bool new_backquote_flag;
155 155
156/* A list of file names for files being loaded in Fload. Used to 156/* A list of file names for files being loaded in Fload. Used to
@@ -2187,7 +2187,7 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
2187 Lisp_Object retval; 2187 Lisp_Object retval;
2188 2188
2189 readchar_count = 0; 2189 readchar_count = 0;
2190 new_backquote_flag = 0; 2190 new_backquote_flag = force_new_style_backquotes;
2191 /* We can get called from readevalloop which may have set these 2191 /* We can get called from readevalloop which may have set these
2192 already. */ 2192 already. */
2193 if (! HASH_TABLE_P (read_objects_map) 2193 if (! HASH_TABLE_P (read_objects_map)
@@ -5006,6 +5006,17 @@ Note that if you customize this, obviously it will not affect files
5006that are loaded before your customizations are read! */); 5006that are loaded before your customizations are read! */);
5007 load_prefer_newer = 0; 5007 load_prefer_newer = 0;
5008 5008
5009 DEFVAR_BOOL ("force-new-style-backquotes", force_new_style_backquotes,
5010 doc: /* Non-nil means to always use the current syntax for backquotes.
5011If nil, `load' and `read' raise errors when encountering some
5012old-style variants of backquote and comma. If non-nil, these
5013constructs are always interpreted as described in the Info node
5014`(elisp)Backquotes', even if that interpretation is incompatible with
5015previous versions of Emacs. Setting this variable to non-nil makes
5016Emacs compatible with the behavior planned for Emacs 28. In Emacs 28,
5017this variable will become obsolete. */);
5018 force_new_style_backquotes = false;
5019
5009 /* Vsource_directory was initialized in init_lread. */ 5020 /* Vsource_directory was initialized in init_lread. */
5010 5021
5011 DEFSYM (Qcurrent_load_list, "current-load-list"); 5022 DEFSYM (Qcurrent_load_list, "current-load-list");