Julia and Emacs - gher-uliege/Documentation GitHub Wiki
Install Emacs (tested with version 29.3) and julia
Configure Emacs
Copy the following in your ~/.emacs
file (create the file if it does not already exist):
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(require 'use-package)
(use-package company :ensure t)
(use-package julia-mode :ensure t :mode "\\.jl$")
(use-package julia-repl :ensure t)
(use-package eglot-jl :ensure t)
(setq eglot-connect-timeout 6000)
(setq eglot-autoreconnect nil)
(setq ring-bell-function 'ignore)
(add-hook 'julia-mode-hook 'julia-repl-mode)
(add-hook 'julia-mode-hook 'company-mode)
(add-hook 'julia-mode-hook (lambda ()
(eglot-jl-init)
(eglot-ensure)))
[!NOTE]
Check the package information about the minimum Emacs version supported
Key bindings
julia-repl
C-c C-a
: activate if there is aProject.toml
in parent directoriesC-u C-c C-a
: activate home projectC-c C-b
: send whole buffer to REPL (usinginclude
)C-u C-c C-b
: send whole buffer to REPL (directly)C-c C-c
: send region (when applicable) or line to REPLC-c C-d
: invoke @doc on symbolC-c C-e
: invoke @edit on region (when applicable) or lineC-c C-l
: list methods of a functionC-c C-m
: expand macroC-c C-p
: change directory to that of the bufferC-c C-s
: prompt for buffer name suffixC-c C-t
: send whole buffer to REPL (usingRevise.includet
)C-c C-v
: prompt for Julia executableC-c C-z
: raise the REPL or create a new one (or switch back from REPL – only in vterm backend)C-RET
: send line to REPL (without bracketed paste)
Eglot
M-.
: go to definitionM-?
: find referencesC-c C-d
: show documentationM-x eglot-format
: format bufferM-x eglot-rename
: rename symbol
References: