Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
347 stars 231 forks source link

syntax highlighting bug in emacs #537

Closed pzinn closed 7 years ago

pzinn commented 7 years ago

This is a bug I'm sure we all know about: Currently, the two-character sequence {- is incorrectly interpreted as the start of a comment by emacs. This is due to a weird limitation of the comment highlighting syntax of emacs, which allows two different two-character comment sequences only if they start with the same first character, which is not the case in Macaulay2: { comment style 1 } vs: -- comment style 2 this is easy to fix and I finally got around to doing it, so this is only a heads up that I will soon submit a pull request for that (maybe after the current one is validated?).

DanGrayson commented 7 years ago

This has annoyed me forever. Shall we just change the comment sequence? I don't much like {- -} anyway, because lists of numbers should be able to typed like this: {-2,3,4}.

mikestillman commented 7 years ago

What would you suggest as an alternative? {* *} ?

On Nov 16, 2016, at 8:17 PM, Daniel R. Grayson notifications@github.com wrote:

This has annoyed me forever. Shall we just change the comment sequence? I don't much like {- -} anyway, because lists of numbers should be able to typed like this: {-2,3,4}.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Macaulay2/M2/issues/537#issuecomment-261125813, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGPR15jO7qBzZ-er27xeeBifoXA8n3tks5q-6s9gaJpZM4K0gOc.

DanGrayson commented 7 years ago

Sounds good, but could emacs handle it?

pzinn commented 7 years ago

I'm not sure I understand. {- is not a comment. I use it all the time for example to type lists with negative integers. it just annoys me that emacs believes it's a comment. Or maybe you're just asking how I'm fixing the problem: I only declare { and *} as comments, and manually add in M2-symbols.m2 that regexp --. has comment font. I'm of course not changing any functionality of Maculay2 the only side-effect I can see is rather minor: it's that in interactive mode, commented out parts of the input (with --) are not highlighted any longer after input is executed (in line with the fact that highlighting is only turned on for code you're currently typing, but contrary to say strings and comments, whose highlighting is coded at a different level and which therefore remain highlighted even after execution)

DanGrayson commented 7 years ago

Oops, I was confused and thought we were using {- -} rather than {* *}.

It sounds like you have a good fix. Thanks!

mikestillman commented 7 years ago

Yes, I don’t know what I was thinking, multiline comments are already {* … *} !

On Nov 16, 2016, at 8:35 PM, Paul Zinn-Justin notifications@github.com wrote:

I'm not sure I understand. {- is not a comment. I use it all the time for example to type lists with negative integers. it just annoys me that emacs believes it's a comment. Or maybe you're just asking how I'm fixing the problem: I only declare {* and } as comments, and manually add in M2-symbols.m2 that regexp --. has comment font. I'm of course not changing any functionality of Maculay2 the only side-effect I can see is rather minor: it's that in interactive mode, commented out parts of the input (with --) are not highlighted any longer after input is executed (in line with the fact that highlighting is only turned on for code you're currently typing, but contrary to say strings and comments, whose highlighting is coded at a different level and which therefore remain highlighted even after execution)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Macaulay2/M2/issues/537#issuecomment-261128649, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGPR9xcPLxc6Vwh05VhkBEKNzwtyYF5ks5q-693gaJpZM4K0gOc.