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 #22 received at 36970 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: emacsuser <at> freemail.hu, 36970 <at> debbugs.gnu.org
Subject: Re: bug#36970: 26.2; invalid-read-syntax could print the location
 of the error
Date: Mon, 01 Feb 2021 09:40:07 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> And...  I'm slightly nervous about calling out to something as
>> complicated as Fcount_lines.
>
> What is Fcount_lines?

Sorry, I meant `count-lines'.

>> 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.
>
> Can you tell why did you think display_count_lines will not do the job
> you need it to do?

Because it's only used in xdisp.c, and I was guessing there was some
reason for that, and:

   Set *BYTE_POS_PTR to the byte position where we stopped.  This is
   either the position COUNT lines after/before START_BYTE, if we
   found COUNT lines, or LIMIT_BYTE if we hit the limit before finding
   COUNT lines.  */

So from the comments it seemed like this had some other, more complex
use case.  But I see from the actual call sites that it looks just like
what I need:

	nlines = display_count_lines (startpos_byte,
				      PT_BYTE, PT, &junk);

So I guess I should just put the prototype in lisp.h and use it?  (It's
kinda surprising that no other part of Emacs has felt the need to
compute a line number before...)

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