* bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined
@ 2019-06-29 13:23 Sam Halliday
2019-06-29 13:27 ` bug#36434: additional information Sam Halliday
2019-06-29 21:47 ` bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined Stefan Monnier
0 siblings, 2 replies; 4+ messages in thread
From: Sam Halliday @ 2019-06-29 13:23 UTC (permalink / raw)
To: 36434
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))
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#36434: additional information
2019-06-29 13:23 bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined Sam Halliday
@ 2019-06-29 13:27 ` Sam Halliday
2019-06-29 21:47 ` bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined Stefan Monnier
1 sibling, 0 replies; 4+ messages in thread
From: Sam Halliday @ 2019-06-29 13:27 UTC (permalink / raw)
To: 36434
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined
2019-06-29 13:23 bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined Sam Halliday
2019-06-29 13:27 ` bug#36434: additional information Sam Halliday
@ 2019-06-29 21:47 ` Stefan Monnier
2021-06-22 14:11 ` Lars Ingebrigtsen
1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2019-06-29 21:47 UTC (permalink / raw)
To: Sam Halliday; +Cc: 36434
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined
2019-06-29 21:47 ` bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined Stefan Monnier
@ 2021-06-22 14:11 ` Lars Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-22 14:11 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Sam Halliday, 36434
Stefan Monnier <monnier@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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-22 14:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-29 13:23 bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined Sam Halliday
2019-06-29 13:27 ` bug#36434: additional information Sam Halliday
2019-06-29 21:47 ` bug#36434: 26.2; smie-rule-next-p needs smie--after to be defined Stefan Monnier
2021-06-22 14:11 ` Lars Ingebrigtsen
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).