GNU bug report logs -
#18764
24.4; electric-indent in *scratch* signals an error
Previous Next
Reported by: Eli Zaretskii <eliz <at> gnu.org>
Date: Sat, 18 Oct 2014 15:00:03 UTC
Severity: normal
Tags: confirmed, fixed, patch
Found in versions 24.4, 26.1
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18764 in the body.
You can then email your comments to 18764 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Sat, 18 Oct 2014 15:00:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 18 Oct 2014 15:00:04 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In "emacs -Q":
1) Insert the following long sequence of left parens followed by a somewhat
shorter sequence of right parens:
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
2) Put cursor after the last right parenthesis, and type RET
3) Emacs signals an error:
lisp-indent-line: Wrong type argument: number-or-marker-p, nil
Here's the Lisp backtrace:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
calculate-lisp-indent()
lisp-indent-line()
indent-according-to-mode()
electric-indent-post-self-insert-function()
self-insert-command(1)
newline(nil 1)
funcall-interactively(newline nil 1)
call-interactively(newline nil nil)
command-execute(newline)
In GNU Emacs 24.4.1 (i686-pc-mingw32)
of 2014-10-17 on HOME-C4E4A596F7
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
`configure --prefix=/d/usr'
Important settings:
value of $LANG: ENU
locale-coding-system: cp1255
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (
( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (
( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (
( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( <return>
C-/ ) <return> C-/ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) <return>
C-/ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
<return> C-/ ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) <return>
<backspace> <backspace> <backspace> <backspace> <return>
<help-echo> <up> <up> <up> <C-end> <return> ( ( ( (
( ( ( ( ( ( ( ( ( ) ) ) ) ) ) ) ) ) ) ) <return> C-/
) <return> C-/ ) <return> C-/ ) <return> <up> <up>
<C-end> <return> <return> C-y <return> C-/ M-x r e
p o r t - e m <tab> <return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Undo! [4 times]
Mark set
Undo! [3 times]
Mark set [2 times]
lisp-indent-line: Wrong type argument: number-or-marker-p, nil
Undo!
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp
w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process w32notify w32
multi-tty emacs)
Memory information:
((conses 8 74585 7049)
(symbols 32 17521 0)
(miscs 32 45 339)
(strings 16 10814 3613)
(string-bytes 1 269937)
(vectors 8 9552)
(vector-slots 4 385033 4696)
(floats 8 58 351)
(intervals 28 279 94)
(buffers 508 11))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Fri, 15 Jun 2018 02:35:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 18764 <at> debbugs.gnu.org (full text, mbox):
tags 18764 + confirmed
found 18764 26.1
quit
Eli Zaretskii <eliz <at> gnu.org> writes:
> In "emacs -Q":
>
> 1) Insert the following long sequence of left parens followed by a somewhat
> shorter sequence of right parens:
Specifically, the sequence of left parens must be more than 100, to hit
this limit:
static void
scan_sexps_forward(...)
{...
struct level levelstart[100];
struct level *curlevel = levelstart;
struct level *endlevel = levelstart + 100;
...
case Sopen:
...
if (++curlevel == endlevel)
curlevel--; /* error ("Nesting too deep for parser"); */
and a sequence of 100 close parens so that the curlevel stack will be
completely popped:
case Sclose:
...
if (curlevel != levelstart)
curlevel--;
In this case parse-partial-sexp will have the right depth, but
incorrectly have nil for element 2 "character address of start of last
complete sexp terminated."
Not sure exactly what to do about this though. Maybe parse-partial-sexp
should (optionally?) signal an error when the curlevel stack overflows?
Added tag(s) confirmed.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 15 Jun 2018 02:35:02 GMT)
Full text and
rfc822 format available.
bug Marked as found in versions 26.1.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 15 Jun 2018 02:35:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Sat, 16 Jun 2018 11:31:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 18764 <at> debbugs.gnu.org (full text, mbox):
> From: Noam Postavsky <npostavs <at> gmail.com>
> Cc: 18764 <at> debbugs.gnu.org
> Date: Thu, 14 Jun 2018 22:34:35 -0400
>
> Not sure exactly what to do about this though. Maybe parse-partial-sexp
> should (optionally?) signal an error when the curlevel stack overflows?
Why do we produce an error instead of just inserting the character?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Sat, 16 Jun 2018 13:49:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 18764 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Noam Postavsky <npostavs <at> gmail.com>
>> Cc: 18764 <at> debbugs.gnu.org
>> Date: Thu, 14 Jun 2018 22:34:35 -0400
>>
>> Not sure exactly what to do about this though. Maybe parse-partial-sexp
>> should (optionally?) signal an error when the curlevel stack overflows?
>
> Why do we produce an error instead of just inserting the character?
I don't quite follow; the newline character has already been inserted as
far as I can tell. Then we signal an error while trying to indent.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Sat, 16 Jun 2018 15:04:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 18764 <at> debbugs.gnu.org (full text, mbox):
> From: Noam Postavsky <npostavs <at> gmail.com>
> Cc: 18764 <at> debbugs.gnu.org
> Date: Sat, 16 Jun 2018 09:48:18 -0400
>
> > Why do we produce an error instead of just inserting the character?
>
> I don't quite follow; the newline character has already been inserted as
> far as I can tell. Then we signal an error while trying to indent.
Then let me rephrase: why are we signaling an error instead of
silently doing nothing? IOW, if something cannot be indented, let's
leave it unindented. Does that make sense?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Sat, 16 Jun 2018 23:14:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 18764 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Then let me rephrase: why are we signaling an error instead of
> silently doing nothing? IOW, if something cannot be indented, let's
> leave it unindented. Does that make sense?
So just suppress the errors? Worries me a bit that some future problems
could be harder to find because of that.
--- i/lisp/electric.el
+++ w/lisp/electric.el
@@ -262,6 +262,7 @@ electric-indent-post-self-insert-function
(unless (eq act 'do-indent) (nth 8 (syntax-ppss))))))))
;; For newline, we want to reindent both lines and basically behave like
;; reindent-then-newline-and-indent (whose code we hence copied).
+ (ignore-errors
(let ((at-newline (<= pos (line-beginning-position))))
(when at-newline
(let ((before (copy-marker (1- pos) t)))
@@ -285,7 +286,7 @@ electric-indent-post-self-insert-function
(delete-horizontal-space t)))))
(unless (and electric-indent-inhibit
(not at-newline))
- (indent-according-to-mode))))))
+ (indent-according-to-mode)))))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Sun, 17 Jun 2018 03:49:01 GMT)
Full text and
rfc822 format available.
Message #27 received at 18764 <at> debbugs.gnu.org (full text, mbox):
> From: Noam Postavsky <npostavs <at> gmail.com>
> Cc: 18764 <at> debbugs.gnu.org
> Date: Sat, 16 Jun 2018 19:13:29 -0400
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > Then let me rephrase: why are we signaling an error instead of
> > silently doing nothing? IOW, if something cannot be indented, let's
> > leave it unindented. Does that make sense?
>
> So just suppress the errors?
Yes.
> Worries me a bit that some future problems could be harder to find
> because of that.
I submit that any errors in code that tries to indent should be
suppressed, as they are not relevant to what the user wanted. If
those errors are important in other contexts, they will pop up there,
and can then decide what to do with them.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Mon, 18 Jun 2018 09:34:01 GMT)
Full text and
rfc822 format available.
Message #30 received at 18764 <at> debbugs.gnu.org (full text, mbox):
On 6/17/18 6:48 AM, Eli Zaretskii wrote:
> I submit that any errors in code that tries to indent should be
> suppressed, as they are not relevant to what the user wanted. If
> those errors are important in other contexts, they will pop up there,
> and can then decide what to do with them.
That's going to make user complaints like "why it doesn't indent" or "it
doesn't indent right" harder to debug and address.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Mon, 18 Jun 2018 15:16:01 GMT)
Full text and
rfc822 format available.
Message #33 received at 18764 <at> debbugs.gnu.org (full text, mbox):
> Cc: 18764 <at> debbugs.gnu.org
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> Date: Mon, 18 Jun 2018 12:33:34 +0300
>
> On 6/17/18 6:48 AM, Eli Zaretskii wrote:
>
> > I submit that any errors in code that tries to indent should be
> > suppressed, as they are not relevant to what the user wanted. If
> > those errors are important in other contexts, they will pop up there,
> > and can then decide what to do with them.
>
> That's going to make user complaints like "why it doesn't indent" or "it
> doesn't indent right" harder to debug and address.
IMO, this is a lesser evil. And if it turns out to be a real problem,
we could always add a variable to control whether such errors are
silently ignored.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Thu, 21 Jun 2018 00:20:02 GMT)
Full text and
rfc822 format available.
Message #36 received at 18764 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 18764 + patch
quit
Eli Zaretskii <eliz <at> gnu.org> writes:
>> That's going to make user complaints like "why it doesn't indent" or "it
>> doesn't indent right" harder to debug and address.
>
> IMO, this is a lesser evil. And if it turns out to be a real problem,
> we could always add a variable to control whether such errors are
> silently ignored.
We can be a little more discriminating than my initial blanket
`ignore-errors', see commit message in the attached patch:
[v2-0001-Suppress-indent-errors-during-electric-indentatio.patch (text/plain, attachment)]
Added tag(s) patch.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 21 Jun 2018 00:20:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Thu, 21 Jun 2018 14:40:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 18764 <at> debbugs.gnu.org (full text, mbox):
> From: Noam Postavsky <npostavs <at> gmail.com>
> Cc: Dmitry Gutov <dgutov <at> yandex.ru>, 18764 <at> debbugs.gnu.org
> Date: Wed, 20 Jun 2018 20:19:16 -0400
>
> >> That's going to make user complaints like "why it doesn't indent" or "it
> >> doesn't indent right" harder to debug and address.
> >
> > IMO, this is a lesser evil. And if it turns out to be a real problem,
> > we could always add a variable to control whether such errors are
> > silently ignored.
>
> We can be a little more discriminating than my initial blanket
> `ignore-errors', see commit message in the attached patch:
Fine with me, but I'd prefer a comment in the code explaining why we
catch errors here.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Sun, 24 Jun 2018 01:41:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 18764 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> We can be a little more discriminating than my initial blanket
>> `ignore-errors', see commit message in the attached patch:
>
> Fine with me, but I'd prefer a comment in the code explaining why we
> catch errors here.
I added some more explanation in the comment over the `catch', and
remembered to use condition-case-unless-debug.
[v3-0001-Suppress-indent-errors-during-electric-indentatio.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Sun, 24 Jun 2018 14:54:01 GMT)
Full text and
rfc822 format available.
Message #47 received at 18764 <at> debbugs.gnu.org (full text, mbox):
> From: Noam Postavsky <npostavs <at> gmail.com>
> Cc: 18764 <at> debbugs.gnu.org, dgutov <at> yandex.ru
> Date: Sat, 23 Jun 2018 21:40:25 -0400
>
> > Fine with me, but I'd prefer a comment in the code explaining why we
> > catch errors here.
>
> I added some more explanation in the comment over the `catch', and
> remembered to use condition-case-unless-debug.
LGTM, thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18764
; Package
emacs
.
(Mon, 25 Jun 2018 23:22:02 GMT)
Full text and
rfc822 format available.
Message #50 received at 18764 <at> debbugs.gnu.org (full text, mbox):
tags 18764 fixed
close 18764 27.1
quit
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Noam Postavsky <npostavs <at> gmail.com>
>> Cc: 18764 <at> debbugs.gnu.org, dgutov <at> yandex.ru
>> Date: Sat, 23 Jun 2018 21:40:25 -0400
>>
>> > Fine with me, but I'd prefer a comment in the code explaining why we
>> > catch errors here.
>>
>> I added some more explanation in the comment over the `catch', and
>> remembered to use condition-case-unless-debug.
>
> LGTM, thanks.
Pushed to master.
[1: c71fb6b0cd]: 2018-06-25 19:18:55 -0400
Suppress indent errors during electric indentation (Bug#18764)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c71fb6b0cdb7043e2828a6843496ab20f4577cbb
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 25 Jun 2018 23:22:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
18764 <at> debbugs.gnu.org and Eli Zaretskii <eliz <at> gnu.org>
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 25 Jun 2018 23:22:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 24 Jul 2018 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 28 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.