aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-03-25 17:20:35 +0100
committerLars Ingebrigtsen2022-03-25 17:20:35 +0100
commitec2f2ed65ef5232c83ed84384b0f6230345c7d78 (patch)
tree1d82587941a93148a47af9cbfd56b60b160d1b9b /src
parent3e7257c3ed3e7f5451d4dab0b222f93a2d1b2aa3 (diff)
downloademacs-ec2f2ed65ef5232c83ed84384b0f6230345c7d78.tar.gz
emacs-ec2f2ed65ef5232c83ed84384b0f6230345c7d78.zip
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).
Diffstat (limited to 'src')
-rw-r--r--src/lread.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/lread.c b/src/lread.c
index d7b56c5087e..6130300b0a2 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -550,13 +550,21 @@ invalid_syntax_lisp (Lisp_Object s, Lisp_Object readcharfun)
550{ 550{
551 if (BUFFERP (readcharfun)) 551 if (BUFFERP (readcharfun))
552 { 552 {
553 ptrdiff_t line, column;
554
555 /* Get the line/column in the readcharfun buffer. */
556 {
557 specpdl_ref count = SPECPDL_INDEX ();
558
559 record_unwind_protect_excursion ();
560 set_buffer_internal (XBUFFER (readcharfun));
561 line = count_lines (BEGV_BYTE, PT_BYTE) + 1;
562 column = current_column ();
563 unbind_to (count, Qnil);
564 }
565
553 xsignal (Qinvalid_read_syntax, 566 xsignal (Qinvalid_read_syntax,
554 list3 (s, 567 list3 (s, make_fixnum (line), make_fixnum (column)));
555 /* We should already be in the readcharfun
556 buffer when this error is called, so no need
557 to switch to it first. */
558 make_fixnum (count_lines (BEGV_BYTE, PT_BYTE) + 1),
559 make_fixnum (current_column ())));
560 } 568 }
561 else 569 else
562 xsignal1 (Qinvalid_read_syntax, s); 570 xsignal1 (Qinvalid_read_syntax, s);