# Emacs + org mode packages and tips

**URL:** https://discourse.julialang.org/t/emacs-org-mode-packages-and-tips/47911
**Category:** Tooling
**Tags:** emacs
**Created:** [October 7, 2020, 3:41am UTC](https://discourse.julialang.org/t/emacs-org-mode-packages-and-tips/47911 "2020-10-07T03:41:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![timquelch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/timquelch/32/18278_2.png) [@timquelch](https://discourse.julialang.org/u/timquelch)
#### Post date: [October 7, 2020, 3:41am UTC](https://discourse.julialang.org/t/emacs-org-mode-packages-and-tips/47911/1 "2020-10-07T03:41:16Z")

</div>

What is everyone’s experiences with the different julia packages for Emacs? How have you found the literate programming experience in org mode?

- **julia-repl:** Quite a good repl interface. No real complaints
- **ob-julia (ess?):** The org-babel interface. This is what allows you to run `julia` code blocks in org mode. It is pretty bad as far as I can tell. Not maintained since 2017. Running single source blocks runs it in a single command line process. Running it in a session seems starts an ess repl which I couldn’t get to work.
- **emacs-jupyter:** Gives both a REPL and running of org mode source blocks with `jupyter-julia` code. Seems to be fairly well maintained. Not sure if it is just my setup, but the completion-at-point functionality seems incredibly slow (basically unusable).
- **lsp-julia:** The interface between `lsp-mode` and julia. This allows language server functionality (similar to the vs-code plugin). My experience is pretty good so far, I’m getting completions, warnings, renaming, and some code actions. The warning behaviour is a little bit dodgy in and around macro calls. I often get MissingReference warnings on symbols defined or used in macros.

I think ideally I would love to see `ob-julia` rewritten in terms of `julia-repl` rather than `ess` (mostly because `julia-repl` actually works). However I’m also fairly happy `emacs-jupyter`.

What are everyone else’s experiences with these packages (or any other ones that I haven’t discovered yet)? Any tips or tricks?

---

<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: [October 7, 2020, 8:24am UTC](https://discourse.julialang.org/t/emacs-org-mode-packages-and-tips/47911/2 "2020-10-07T08:24:55Z")

</div>

> [@timquelch](#):
>
> **julia-repl:** Quite a good repl interface. No real complaints

As the author, I am happy to hear this! But I see quite a few areas for improvement — `libvterm` integration is my current priority.

---

<div class="post-metadata">

### Author: ![antoine-levitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoine-levitt/32/4008_2.png) [@antoine-levitt](https://discourse.julialang.org/u/antoine-levitt)
#### Post date: [October 7, 2020, 9:00am UTC](https://discourse.julialang.org/t/emacs-org-mode-packages-and-tips/47911/3 "2020-10-07T09:00:06Z")

</div>

I use `julia-repl` which works pretty well (and will be even better once vterm is in). I never tried any of the more fancy options like lsp-julia and emacs-jupyter, cool to see it works well! Regarding tips and tricks, if you do a lot of math I highly recommend the following snippet:

```julia
;; Math insertion
(defun julia-math-insert (s)
  "Inserts math symbol given by `s'"
  (when s
    (let ((sym (gethash (concat "\\" s) julia-mode-latexsubs)))
      (when sym
	(if (and (eq major-mode 'term-mode) (term-in-char-mode))
	    (progn
	      (term-send-raw-string sym))
          (insert sym))))))

;; unicode insertion of math symbols
(define-minor-mode julia-math-mode
  "A minor mode with easy access to TeX math commands. The
command is only entered if it is supported in Julia. The
following commands are defined:

\\{LaTeX-math-mode-map}"
  nil nil (list (cons (LaTeX-math-abbrev-prefix) LaTeX-math-keymap))
  (if julia-math-mode
      (set (make-local-variable 'LaTeX-math-insert-function) 'julia-math-insert)))

(define-globalized-minor-mode global-math-mode julia-math-mode
  (lambda ()
    (unless (eq major-mode 'latex-mode)
      (julia-math-mode))))
(global-math-mode 1)
;; (add-hook 'julia-mode-hook 'julia-math-mode)
;; (add-hook 'inferior-julia-mode-hook 'julia-math-mode)
;; (add-hook 'inferior-ess-mode-hook 'julia-math-mode)
;; (add-hook 'message-mode-hook 'julia-math-mode)

;; Make math insertion work in isearch
(add-hook 'isearch-mode-hook 'isearch-setup-latex-math)
(add-hook 'isearch-mode-end-hook 'isearch-unsetup-latex-math)
(define-key isearch-mode-map (LaTeX-math-abbrev-prefix) LaTeX-math-keymap)

(defun isearch-setup-latex-math ()
  (if (eq (current-mm) 'latex-mode)
      (set (make-local-variable 'LaTeX-math-insert-function) (lambda (s) (isearch-process-search-string (concat "\\" s) (concat "\\" s))))
    (set (make-local-variable 'LaTeX-math-insert-function) (lambda (s) (isearch-process-search-string (gethash (concat "\\" s) julia-mode-latexsubs) (gethash (concat "\\" s) julia-mode-latexsubs))))))

(defun isearch-unsetup-latex-math ()
  (if (eq (current-mm) 'latex-mode)
      (set (make-local-variable 'LaTeX-math-insert-function) 'TeX-insert-macro)
    (set (make-local-variable 'LaTeX-math-insert-function) 'julia-math-insert)))

```

---

<div class="post-metadata">

### Author: ![yarnton](https://avatars.discourse-cdn.com/v4/letter/y/ac91a4/32.png) [@yarnton](https://discourse.julialang.org/u/yarnton)
#### Post date: [October 16, 2020, 10:03pm UTC](https://discourse.julialang.org/t/emacs-org-mode-packages-and-tips/47911/5 "2020-10-16T22:03:52Z")

</div>

I’m also a happy camper when using `julia-repl`, so thanks for the package @Tamas_Papp!

I used to use `ess`, but it is a bit unstable with Julia.

`julia-mode` + `julia-repl` are a good basic setup. What else do you use in conjunction with these?

I always build Emacs configurations slowly, and I prefer minimal setups. Is LSP (via `lsp-mode` or `eglot`) the preferred way to get completions?
