From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacsuser@freemail.hu, 36970@debbugs.gnu.org
Subject: bug#36970: 26.2; invalid-read-syntax could print the location of the error
Date: Mon, 01 Feb 2021 09:40:07 +0100 [thread overview]
Message-ID: <87k0rsrxjs.fsf@gnus.org> (raw)
In-Reply-To: <831re1887h.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 31 Jan 2021 16:57:54 +0200")
Eli Zaretskii <eliz@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
next prev parent reply other threads:[~2021-02-01 8:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 8:27 bug#36970: 26.2; invalid-read-syntax could print the location of the error ndame
2021-01-30 7:54 ` Lars Ingebrigtsen
2021-01-31 9:14 ` Lars Ingebrigtsen
2021-01-31 10:15 ` Lars Ingebrigtsen
2021-01-31 14:57 ` Eli Zaretskii
2021-02-01 8:40 ` Lars Ingebrigtsen [this message]
2021-02-01 15:06 ` Eli Zaretskii
2021-02-01 16:10 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k0rsrxjs.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=36970@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=emacsuser@freemail.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).