Subject: bug#36970: 26.2; invalid-read-syntax could print the location of the error

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 01 Feb 2021 17:10:30 +0100

Eli Zaretskii <[email-masked]> writes:

> Yes (and make it non-static).  Alternatively, define a wrapper for it
> that doesn't accept that last arg, and make _that_ wrapper extern and
> more suitably named.

Yup.  I've made the wrapper even simpler, and dropped the count, too.

>> (It's kinda surprising that no other part of Emacs has felt the need
>> to compute a line number before...)
>
> Emacs almost never counts lines, except for 2 display features: the
> line-number display in the mode line and display-line-numbers-mode.
> The buffer-with-gap paradigm makes a point of not knowing where each
> line ends and how many lines are there.

Emacs almost never counts lines while running normally, but line numbers
are useful when reporting errors (like here), so I was surprised not to
find a convenient function to use.  On the other hand, perhaps this
explains why errors like these didn't use to report lines.  :-)

Anyway, I'm running some more tests, and then I'll push the change.  The
error message could be improved: It's

		CALLN (Fformat, build_string ("%s (line %d, column %d)"),

which looks a bit awkward -- feel free to tweak, everybody.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no