GNU bug report logs - #38255
27.0.50; Indentation error-out in css-mode

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Mon, 18 Nov 2019 12:16:02 UTC

Severity: normal

Found in version 27.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 38255 in the body.
You can then email your comments to 38255 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38255; Package emacs. (Mon, 18 Nov 2019 12:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lars Ingebrigtsen <larsi <at> gnus.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 18 Nov 2019 12:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Indentation error-out in css-mode
Date: Mon, 18 Nov 2019 13:15:03 +0100
Open a.css and type:

foo {
}
}

The following backtrace is triggered.

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  smie-next-sexp(#f(compiled-function () #<bytecode 0x155d7de91a0d>) #f(compiled-function (n) #<bytecode 0x155d7f00a465>) #<subr car> #f(compiled-function (x) "Return the car of the cdr of X." #<bytecode 0x1ffc61806017>) "}")
  smie-backward-sexp("}")
  smie-indent-keyword()
  run-hook-with-args-until-success(smie-indent-keyword)
  smie-indent-calculate()
  smie-indent-line()
  indent-according-to-mode()
  electric-indent-post-self-insert-function()
  self-insert-command(1 125)
  funcall-interactively(self-insert-command 1 125)
  call-interactively(self-insert-command nil nil)
  command-execute(self-insert-command)



In GNU Emacs 27.0.50 (build 52, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-11-17 built on marnie
Repository revision: 3fdc36eecb3ab468eb0a55cc09a176ab503d31c3
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38255; Package emacs. (Thu, 21 Nov 2019 15:10:01 GMT) Full text and rfc822 format available.

Message #8 received at 38255 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 38255 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#38255: 27.0.50; Indentation error-out in css-mode
Date: Thu, 21 Nov 2019 16:09:42 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Open a.css and type:
>
> foo {
> }
> }
>
> The following backtrace is triggered.
>
> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>   smie-next-sexp(#f(compiled-function () #<bytecode 0x155d7de91a0d>) #f(compiled-function (n) #<bytecode 0x155d7f00a465>) #<subr car> #f(compiled-function (x) "Return the car of the cdr of X." #<bytecode 0x1ffc61806017>) "}")
>   smie-backward-sexp("}")
>   smie-indent-keyword()
>   run-hook-with-args-until-success(smie-indent-keyword)

Stefan, I tried to follow the logic in smie-backward-sexp here, but I'm
somewhat confused.  (More than usual, even.)  Could you have a look at this?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Thu, 21 Nov 2019 23:30:02 GMT) Full text and rfc822 format available.

Notification sent to Lars Ingebrigtsen <larsi <at> gnus.org>:
bug acknowledged by developer. (Thu, 21 Nov 2019 23:30:02 GMT) Full text and rfc822 format available.

Message #13 received at 38255-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 38255-done <at> debbugs.gnu.org
Subject: Re: bug#38255: 27.0.50; Indentation error-out in css-mode
Date: Thu, 21 Nov 2019 18:29:14 -0500
>> foo {
>> }
>> }
>>
>> The following backtrace is triggered.
>>
>> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>>   smie-next-sexp(#f(compiled-function () #<bytecode 0x155d7de91a0d>)
>> #f(compiled-function (n) #<bytecode 0x155d7f00a465>) #<subr car>
>> #f(compiled-function (x) "Return the car of the cdr of X." #<bytecode
>> 0x1ffc61806017>) "}")
>>   smie-backward-sexp("}")
>>   smie-indent-keyword()
>>   run-hook-with-args-until-success(smie-indent-keyword)

Thanks for the great recipe.  I pushed the fix below to Emacs's master.


        Stefan


diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index f2163b243e..2c2898ae71 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -702,7 +702,11 @@ smie-next-sexp
   (catch 'return
     (let ((levels
            (if (stringp halfsexp)
-               (prog1 (list (cdr (assoc halfsexp smie-grammar)))
+               (prog1 (list (or (cdr (assoc halfsexp smie-grammar))
+                                (when (string-match "\\`\\s(\\|\\s)\\(\\)\\'"
+                                                    halfsexp)
+                                  (if (match-end 1) '(0 nil) '(nil 0)))
+                                (error "Unknown token: %S" halfsexp)))
                  (setq halfsexp nil)))))
       (while
           (let* ((pos (point))





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 20 Dec 2019 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 121 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.