[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ec2f2ed65e: Fix reporting of read error line/columns in the init
From: |
Lars Ingebrigtsen |
Subject: |
master ec2f2ed65e: Fix reporting of read error line/columns in the init file |
Date: |
Fri, 25 Mar 2022 12:22:24 -0400 (EDT) |
branch: master
commit ec2f2ed65ef5232c83ed84384b0f6230345c7d78
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix reporting of read error line/columns in the init file
* src/lread.c (invalid_syntax_lisp): The comments here said that
we were supposed to be called with point in the readcharfun
buffer. This was not the case (at least) when reading the Emacs
init file, so the reported line/column was always wrong (1 and 0,
respectively) (bug#54550).
---
src/lread.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/lread.c b/src/lread.c
index d7b56c5087..6130300b0a 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -550,13 +550,21 @@ invalid_syntax_lisp (Lisp_Object s, Lisp_Object
readcharfun)
{
if (BUFFERP (readcharfun))
{
+ ptrdiff_t line, column;
+
+ /* Get the line/column in the readcharfun buffer. */
+ {
+ specpdl_ref count = SPECPDL_INDEX ();
+
+ record_unwind_protect_excursion ();
+ set_buffer_internal (XBUFFER (readcharfun));
+ line = count_lines (BEGV_BYTE, PT_BYTE) + 1;
+ column = current_column ();
+ unbind_to (count, Qnil);
+ }
+
xsignal (Qinvalid_read_syntax,
- list3 (s,
- /* We should already be in the readcharfun
- buffer when this error is called, so no need
- to switch to it first. */
- make_fixnum (count_lines (BEGV_BYTE, PT_BYTE) + 1),
- make_fixnum (current_column ())));
+ list3 (s, make_fixnum (line), make_fixnum (column)));
}
else
xsignal1 (Qinvalid_read_syntax, s);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master ec2f2ed65e: Fix reporting of read error line/columns in the init file,
Lars Ingebrigtsen <=