bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Sun, 31 Jan 2021 10:14:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

>   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.

I started tinkering with this, but there's a couple of things that are
less obvious to me than I thought:

Should the line/column numbers be based on what Fcount_lines return, or
should they be the actual line number of the buffer?  That is, taking
selective display etc into consideration or not?  Ignoring all that and
just counting newlines would make sense in many situations (it's more
like when compiling a file), but not in others?

And...  I'm slightly nervous about calling out to something as
complicated as Fcount_lines.  There's no efficiency considerations here
(this is for error handling only), so I think calling that would be OK,
but it'd be un-fun if the error handling bugged out.

So I was poking through the Emacs lisp code to see whether there's any
function that will just tell me what line I'm on, and there's...
display_count_lines in xdisp.c, but that doesn't really seem like a good
fit, since that's in redisplay, and not lread.c context.

Isn't there any function that will just return the line number at point?
I've been grepping for half an hour without finding anything.

So I wrote a current_line function, which is trivial enough (and fast)
if we're just looking for newlines and ignoring everything else...
which...  may be what we want here?  Or not?

Any opinions?

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]