# \\ left division operator in editors (emacs)

**URL:** <https://discourse.julialang.org/t/left-division-operator-in-editors-emacs/18225>\
**Category:** Numerics\
**Tags:** linearalgebra\
**Created:** [December 2, 2018, 7:49pm UTC](https://discourse.julialang.org/t/left-division-operator-in-editors-emacs/18225 "2018-12-02T19:49:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [December 2, 2018, 7:49pm UTC](https://discourse.julialang.org/t/left-division-operator-in-editors-emacs/18225/1 "2018-12-02T19:49:04Z")

</div>

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

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

```

Anyone know of a better way ?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 3, 2018, 8:23am UTC](https://discourse.julialang.org/t/left-division-operator-in-editors-emacs/18225/2 "2018-12-03T08:23:57Z")

</div>

> [@jlapeyre](#):
>
> Anyone know of a better way ?

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](https://github.com/JuliaEditorSupport/julia-emacs/pull/37), but if this is a different one then please open an issue and I will look into this.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 3, 2018, 8:28am UTC](https://discourse.julialang.org/t/left-division-operator-in-editors-emacs/18225/3 "2018-12-03T08:28:22Z")

</div>

I can replicate _something_, is this it?

[https://github.com/JuliaEditorSupport/julia-emacs/issues/58](https://github.com/JuliaEditorSupport/julia-emacs/issues/58)

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [December 4, 2018, 11:05am UTC](https://discourse.julialang.org/t/left-division-operator-in-editors-emacs/18225/4 "2018-12-04T11:05:40Z")

</div>

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:

```julia
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

```julia
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.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 4, 2018, 11:17am UTC](https://discourse.julialang.org/t/left-division-operator-in-editors-emacs/18225/5 "2018-12-04T11:17:30Z")

</div>

> [@jlapeyre](#):
>
> emacs is misunderstanding legal Julia syntax

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

> [@jlapeyre](#):
>
> I can try to find the MWE (or MNWE) and file an issue.

That would be great, so that we can investigate.

> [@jlapeyre](#):
>
> Have I mentioned yet on this forum how much I love chasing down emacs quirks ?

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 😉

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [December 4, 2018, 12:00pm UTC](https://discourse.julialang.org/t/left-division-operator-in-editors-emacs/18225/6 "2018-12-04T12:00:00Z")

</div>

> [@Tamas\_Papp](#):
>
> That would be great, so that we can investigate.

> <https://github.com/JuliaEditorSupport/julia-emacs/issues/59>
>
> The following
> \`\`\`
> (\\)(2, 4)
> \`\`\`
> breaks auto-indent on subsequent lines.
> 
> T…he following, does \*not\*
> \`\`\`
> \\(2, 4)
> \`\`\`
> 
> I got \*julia-mode.el\* from elpa. But, the file is identical to the master branch here, except for a comment.
