Emacs + org mode packages and tips

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?


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


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:

;; 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))
	      (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:

  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)
(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)))

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?

1 Like