\ left division operator in editors (emacs)

linearalgebra

#1

This operator \ puts my emacs julia-mode in a bad state. After this symbol, it no longer understands expressions.

If I want to use it, or add methods, I do

eval(Meta.parse("import Base: \\"))
const left_division = eval(Meta.parse("\\"))

Anyone know of a better way ?


#2

I think it is handled as an escape, which should be narrowed to strings. Are you using the most recent master? I fixed something similar with #37, but if this is a different one then please open an issue and I will look into this.


#3

I can replicate something, is this it?


#4

Found it. Have I mentioned yet on this forum how much I love chasing down emacs quirks ?

  1. “( upsets paren matching”. Yes, I see this. I am using elpa julia-mode-20180816.2117.

  2. The issue that prompted this post is different. In some circumstances \ broke auto-indent and TAB indent. I had copied and modified code from somewhere else:

struct A end
(Base.:\)(a::A, b::A) = 1

After entering the above, on subsequent lines, auto-indent is broken. I think emacs thinks the expression is incomplete.

But, the method definition is overly complicated. The following, simpler, definition is equivalent

struct A end
\(a::A, b::A) = 1

And this one does not break auto-indent. The upshot is that emacs is misunderstanding legal Julia syntax, but it’s probably not an urgent problem.

If you like. I can try to find the MWE (or MNWE) and file an issue.


#5

Yes, it is a bunch of heuristics, not a fully featured parser.

That would be great, so that we can investigate.

Well, it isn’t my favorite pastime either, but the good thing about it Emacs & Emacs-Lisp is that most bugs can be tracked down and isolated rather quickly once one has an MWE. Then we add it to the tests and hope it never breaks again :wink:


#6