-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #757 indentation of "\in" #789
base: master
Are you sure you want to change the base?
Conversation
The problem was that \in was lexed as "" "in" and that "in" is a (pretty crowdedly overloaded) reserved keyword for let in, Let in,.. I will wait a feedback from #757 before merging this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Matafou, thanks a lot for this fix!
I tested it successfully on another file of mine, as well as on your test file and it worked-out-of-the-box™ (using Emacs 28.2 on Debian 12)
@Matafou Thanks a lot for this fix, which will be important for ssreflect & mathcomp users. I'd say that maybe, this fix + your previous fix #782 alone (!) would deserve to prepare a release soonish. @hendriktews @Matafou WDYT? |
The lexer now glues a "\" to an immediately following word if it is itself preceded by a space. Note that for really good indentation you should try to add something like this to your configuration: (setq coq-smie-user-tokens '(("\\in" . "="))) to tell the indentation grammar that \in has the same precedence as "=". Test added.
8e276e6
to
a36eb9b
Compare
I don't know the exact use of Note that without the |
Basically, the default notation convention in the mathcomp core library is to only use ASCII operators, not UTF-8 or so, and typically it relies on notations very close to those from LaTeX. E.g.:
not exactly, cf. the
You also have IIUC your PR code, the fix is not specific to |
OK, I was hoping for something simple. How naive I am :-). If we can come up with a decent It would look like: (setq coq-smie-user-tokens '(("\in" . "=") ("\notin" . "=") ("\o" . "+") ... )) (I guess Maybe this already exists somewhere? |
Yes the fix is for any token starting with |
OK thanks! So IIUC, in addition to this PR, it just suffices to provide a relevant BTW I tested |
The difference can be subtle and this is very fragile, but here is a difference between Lemma foo:
forall x y,
y
=
z
= y.
Lemma foo:
forall x y,
y
=
z
+ y. |
Note that this is a bit wrong since |
OK thanks @Matafou ! So I'll try to come up with a comprehensive list of the \in | \notin | … mathcomp symbols this WE. Question: can/should this PR be merged beforehand? or implementing the |
I think we can merge. |
The lexer now glues a "" to an immediately following word if it is itself preceded by a space.
Note that for really good indentation you should try to add something like this to your configuration:
(setq coq-smie-user-tokens '(("\in" . "=")))
to tell the indentation grammar that \in has the same precedence as "=".