Skip to content

Commit

Permalink
Expunge read-with-symbol-position and read-symbol-positions-list
Browse files Browse the repository at this point in the history
These are remnants of the old way of determining byte compiler warning
positions.

* src/lread.c (read_internal_start, read1): Remove initializations amd
manipulations of these variables.
(syms_of_lread): Remove the declarations of the variables.

* lisp/emacs-list/bytecomp.el (compile-defun, byte-compile-from-buffer):
Remove bindings of the variables.
  • Loading branch information
Alan Mackenzie committed Jan 24, 2022
1 parent 6cea4d1 commit dfae76c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 47 deletions.
7 changes: 1 addition & 6 deletions lisp/emacs-lisp/bytecomp.el
Original file line number Diff line number Diff line change
Expand Up @@ -2215,9 +2215,7 @@ With argument ARG, insert value in current buffer after the form."
(start-read-position (point))
(byte-compile-last-warned-form 'nothing)
(value (eval
(let ((read-with-symbol-positions (current-buffer))
(read-symbol-positions-list nil)
(symbols-with-pos-enabled t))
(let ((symbols-with-pos-enabled t))
(displaying-byte-compile-warnings
(byte-compile-sexp
(let ((form (read-positioning-symbols (current-buffer))))
Expand Down Expand Up @@ -2252,9 +2250,6 @@ With argument ARG, insert value in current buffer after the form."
(byte-compile-depth 0)
(byte-compile-maxdepth 0)
(byte-compile-output nil)
;; This allows us to get the positions of symbols read.
(read-with-symbol-positions inbuffer)
(read-symbol-positions-list nil)
;; #### This is bound in b-c-close-variables.
;; (byte-compile-warnings byte-compile-warnings)
(symbols-with-pos-enabled t))
Expand Down
41 changes: 0 additions & 41 deletions src/lread.c
Original file line number Diff line number Diff line change
Expand Up @@ -2537,9 +2537,6 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end,
read_objects_completed
= make_hash_table (hashtest_eq, DEFAULT_HASH_SIZE, DEFAULT_REHASH_SIZE,
DEFAULT_REHASH_THRESHOLD, Qnil, false);
if (EQ (Vread_with_symbol_positions, Qt)
|| EQ (Vread_with_symbol_positions, stream))
Vread_symbol_positions_list = Qnil;

if (STRINGP (stream)
|| ((CONSP (stream) && STRINGP (XCAR (stream)))))
Expand All @@ -2561,10 +2558,6 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end,
}

retval = read0 (stream, locate_syms);
if (EQ (Vread_with_symbol_positions, Qt)
|| EQ (Vread_with_symbol_positions, stream))
Vread_symbol_positions_list = Fnreverse (Vread_symbol_positions_list);
/* Empty hashes can be reused; otherwise, reset on next call. */
if (HASH_TABLE_P (read_objects_map)
&& XHASH_TABLE (read_objects_map)->count > 0)
read_objects_map = Qnil;
Expand Down Expand Up @@ -3873,11 +3866,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list, bool locate_syms)
result = build_symbol_with_pos (result,
make_fixnum (start_position));

if (EQ (Vread_with_symbol_positions, Qt)
|| EQ (Vread_with_symbol_positions, readcharfun))
Vread_symbol_positions_list
= Fcons (Fcons (result, make_fixnum (start_position)),
Vread_symbol_positions_list);
return unbind_to (count, result);
}
}
Expand Down Expand Up @@ -5166,35 +5154,6 @@ This variable is obsolete as of Emacs 28.1 and should not be used. */);
See documentation of `read' for possible values. */);
Vstandard_input = Qt;

DEFVAR_LISP ("read-with-symbol-positions", Vread_with_symbol_positions,
doc: /* If non-nil, add position of read symbols to `read-symbol-positions-list'.
If this variable is a buffer, then only forms read from that buffer
will be added to `read-symbol-positions-list'.
If this variable is t, then all read forms will be added.
The effect of all other values other than nil are not currently
defined, although they may be in the future.
The positions are relative to the last call to `read' or
`read-from-string'. It is probably a bad idea to set this variable at
the toplevel; bind it instead. */);
Vread_with_symbol_positions = Qnil;

DEFVAR_LISP ("read-symbol-positions-list", Vread_symbol_positions_list,
doc: /* A list mapping read symbols to their positions.
This variable is modified during calls to `read' or
`read-from-string', but only when `read-with-symbol-positions' is
non-nil.
Each element of the list looks like (SYMBOL . CHAR-POSITION), where
CHAR-POSITION is an integer giving the offset of that occurrence of the
symbol from the position where `read' or `read-from-string' started.
Note that a symbol will appear multiple times in this list, if it was
read multiple times. The list is in the same order as the symbols
were read in. */);
Vread_symbol_positions_list = Qnil;

DEFVAR_LISP ("read-circle", Vread_circle,
doc: /* Non-nil means read recursive structures using #N= and #N# syntax. */);
Vread_circle = Qt;
Expand Down

0 comments on commit dfae76c

Please sign in to comment.