* bug#38255: 27.0.50; Indentation error-out in css-mode
@ 2019-11-18 12:15 Lars Ingebrigtsen
2019-11-21 15:09 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-18 12:15 UTC (permalink / raw)
To: 38255
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#38255: 27.0.50; Indentation error-out in css-mode
2019-11-18 12:15 bug#38255: 27.0.50; Indentation error-out in css-mode Lars Ingebrigtsen
@ 2019-11-21 15:09 ` Lars Ingebrigtsen
2019-11-21 23:29 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-21 15:09 UTC (permalink / raw)
To: 38255; +Cc: Stefan Monnier
Lars Ingebrigtsen <larsi@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
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#38255: 27.0.50; Indentation error-out in css-mode
2019-11-21 15:09 ` Lars Ingebrigtsen
@ 2019-11-21 23:29 ` Stefan Monnier
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2019-11-21 23:29 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 38255-done
>> 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))
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-21 23:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-18 12:15 bug#38255: 27.0.50; Indentation error-out in css-mode Lars Ingebrigtsen
2019-11-21 15:09 ` Lars Ingebrigtsen
2019-11-21 23:29 ` Stefan Monnier
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).