GNU bug report logs - #36970
26.2; invalid-read-syntax could print the location of the error

Previous Next

Package: emacs;

Reported by: ndame <emacsuser <at> freemail.hu>

Date: Thu, 8 Aug 2019 08:29:01 UTC

Severity: wishlist

Tags: fixed

Found in version 26.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 36970 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: ndame <emacsuser <at> freemail.hu>
Cc: 36970 <at> debbugs.gnu.org
Subject: Re: bug#36970: 26.2; invalid-read-syntax could print the location
 of the error
Date: Sat, 30 Jan 2021 08:54:21 +0100
ndame <emacsuser <at> 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




This bug report was last modified 4 years and 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.