GNU bug report logs - #36434
26.2; smie-rule-next-p needs smie--after to be defined

Previous Next

Package: emacs;

Reported by: Sam Halliday <sam.halliday <at> gmail.com>

Date: Sat, 29 Jun 2019 13:24:02 UTC

Severity: normal

Found in version 26.2

To reply to this bug, email your comments to 36434 AT debbugs.gnu.org.

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#36434; Package emacs. (Sat, 29 Jun 2019 13:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sam Halliday <sam.halliday <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 29 Jun 2019 13:24:02 GMT) Full text and rfc822 format available.

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

From: Sam Halliday <sam.halliday <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.2; smie-rule-next-p needs smie--after to be defined
Date: Sat, 29 Jun 2019 14:23:01 +0100
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.

A workaround is to define the variable locally, e.g.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36434; Package emacs. (Sat, 29 Jun 2019 13:28:02 GMT) Full text and rfc822 format available.

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

From: Sam Halliday <sam.halliday <at> gmail.com>
To: 36434 <at> debbugs.gnu.org
Subject: additional information
Date: Sat, 29 Jun 2019 14:27:07 +0100
Furthermore, and probably for the same reasons, it is not possible to
use `smie-rule-parent-p` in an :elem because `smie--parent` is not
defined.

FWIW I'm able to use these functions ok in a :before or :after




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36434; Package emacs. (Sat, 29 Jun 2019 21:48:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Sam Halliday <sam.halliday <at> gmail.com>
Cc: 36434 <at> debbugs.gnu.org
Subject: Re: bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined
Date: Sat, 29 Jun 2019 17:47:16 -0400
> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36434; Package emacs. (Tue, 22 Jun 2021 14:13:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Sam Halliday <sam.halliday <at> gmail.com>, 36434 <at> debbugs.gnu.org
Subject: Re: bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined
Date: Tue, 22 Jun 2021 16:11:55 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> 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).

Looking at the smie-rules-function doc string, this doesn't seem to have
been added?  My understanding of smie is...   er...  let's be
charitable and call it "not funny encompassing", so I don't feel
qualified to take a stab at it.

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




This bug report was last modified 3 years and 363 days ago.

Previous Next


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