[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36970: 26.2; invalid-read-syntax could print the location of the err
From: |
Lars Ingebrigtsen |
Subject: |
bug#36970: 26.2; invalid-read-syntax could print the location of the error |
Date: |
Sat, 30 Jan 2021 08:54:21 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
ndame <emacsuser@freemail.hu> writes:
> It only says:
>
> (invalid-read-syntax ". in wrong context")
>
> It could also print the character location or even the line number and
> the position in the line to make it easy to find the error.
Poking around in read1 and friends, this doesn't seem very difficult to
implement -- the errors are signalled from the invalid_syntax function.
The wrinkle is that we may be reading from a string or something else
based on readcharfun. However, the common case is reading from a
buffer, and we could improve the error message there.
So my idea here would be to change all the calls that are like this:
invalid_syntax (". in wrong context");
into
invalid_syntax (". in wrong context", readcharfun);
and then, in that function do
if (BUFFERP (readcharfun))
make_string_based_on_point ()
Since point is at the problematic element, that could just do a
Fcount_lines/Fcurrent_column to get the line number/column number,
presumably.
Before starting to hack away at this, does anybody see any problems with
this approach?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#36970: 26.2; invalid-read-syntax could print the location of the error,
Lars Ingebrigtsen <=