bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined


From: Stefan Monnier
Subject: bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined
Date: Sat, 29 Jun 2019 17:47:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> When writing SMIE indentation rules, as per `smie-rules-function`,
> when an :elem is received (confirmed at least with 'empty-line-token)
> it is not possible to call the function smie-rule-parent-p, because
> the smie--after variable has not been defined.

[ Hmm... this is related to the smie-rule--parent mess.  ]

But I'm not completely sure how we can define "parent" in a really
unambiguous way, here: in the `empty-line-token` case we're presumably
on an empty line, so there's no token either immediately before or
immediately after.

Basically, I think this is a documentation bug: the smie-rule-*
functions are meant to be used for the :after and :before cases, but not
for :elem where there isn't necessarily such a clear "current token"
(tho I think it would be good to be more careful and try to
define such a "current token" when we can).

>         (defvar smie--after)
>         (setq smie--after (point))

Or use smie-backward-sexp rather than smie-rule-parent, which doesn't
depend on internals.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]