diff --git a/modules/lang/julia/README.org b/modules/lang/julia/README.org index 5f3883a54..bb685d1a2 100644 --- a/modules/lang/julia/README.org +++ b/modules/lang/julia/README.org @@ -20,6 +20,9 @@ This module adds support for [[https://julialang.org/][the Julia language]] to D - +tree-sitter :: Leverages tree-sitter for better syntax highlighting and structural text editing. Requires [[doom-module::tools tree-sitter]]. +- +snail :: Use Snail, a development environment and REPL interaction package + for Julia in the spirit of Common Lisp’s SLIME and Clojure’s CIDER. It enables + convenient and dynamic REPL-driven development. ** Packages - [[doom-package:julia-mode]] @@ -31,6 +34,8 @@ This module adds support for [[https://julialang.org/][the Julia language]] to D - if [[doom-module::tools lsp +eglot]] - [[doom-package:eglot-jl]] - [[doom-package:eglot]] +- if [[doom-package:][+snail]] + - [[doom-package:][julia-snail]] ** Hacks /No hacks documented for this module./ @@ -104,6 +109,19 @@ But to let [[doom-package:eglot-jl]] use the environment bundled with it, set it [[doom-package:eglot]] features. It requires ~LanguageServer.jl~, the installation of which is described above. +** Snail + +| Keybind | Command | +|-----------------------------+-----------------------------------| +| [[kbd:][ ']] | ~julia-snail~ | +| [[kbd:][ a]] | ~julia-snail-package-activate~ | +| [[kbd:][ r]] | ~julia-snail-update-module-cache~ | +| [[kbd:][ d]] | ~julia-snail-doc-lookup~ | +| [[kbd:][ e b]] | ~julia-snail-send-buffer-file~ | +| [[kbd:][ e l]] | ~julia-snail-send-line~ | +| [[kbd:][ e r]] | ~julia-snail-send-region~ | +| [[kbd:][ e e]] | ~julia-snail-send-dwim~ | + * TODO Configuration #+begin_quote 🔨 /This module's configuration documentation is incomplete./ [[doom-contrib-module:][Complete it?]] diff --git a/modules/lang/julia/autoload.el b/modules/lang/julia/autoload.el index d25f60b58..021a6d918 100644 --- a/modules/lang/julia/autoload.el +++ b/modules/lang/julia/autoload.el @@ -19,3 +19,10 @@ (with-current-buffer buffer (inferior-julia-mode)) buffer))) + +;;;###autoload +(defun +julia/open-snail-repl () + "A wrapper for julia-snail" + (interactive) + (julia-snail) + (current-buffer)) diff --git a/modules/lang/julia/config.el b/modules/lang/julia/config.el index cb9273922..6f3f33358 100644 --- a/modules/lang/julia/config.el +++ b/modules/lang/julia/config.el @@ -3,7 +3,8 @@ (use-package! julia-mode :interpreter "julia" :config - (set-repl-handler! 'julia-mode #'+julia/open-repl) + (unless (modulep! +snail) + (set-repl-handler! 'julia-mode #'+julia/open-repl)) (when (modulep! +lsp) (add-hook 'julia-mode-local-vars-hook #'lsp! 'append)) @@ -91,8 +92,46 @@ :after eglot :preface ;; Prevent auto-install of LanguageServer.jl - (setq eglot-jl-language-server-project "~/.julia/environments/v1.6") + (setq eglot-jl-language-server-project + (or (car (last (doom-glob "~/.julia/environments/v*"))) + "~/.julia/environments/v1.6")) :init ;; Prevent timeout while installing LanguageServer.jl (setq-hook! 'julia-mode-hook eglot-connect-timeout (max eglot-connect-timeout 60)) :config (eglot-jl-init)) + + +(use-package! julia-snail + :when (modulep! +snail) + :when (modulep! :term vterm) + :hook (julia-mode . julia-snail-mode) + :config + (setq julia-snail-popup-display-eval-results :command) + (setq julia-snail-multimedia-enable t) + (setq julia-snail-popup-display-face '(:background base3 :box `(:line-width -1 :color base5))) + + (set-popup-rule! "^\\*julia.*\\*$" :ttl nil :select nil :quit nil) + + (after! julia-mode + (set-repl-handler! 'julia-mode #'+julia/open-snail-repl + :persist t + ;; FIXME These aren't working as expected + :send-region #'julia-snail-send-region + :send-buffer #'julia-snail-send-buffer-file)) + + (map! (:localleader + (:map (julia-snail-mode-map) + "'" #'julia-snail + "a" #'julia-snail-package-activate + "r" #'julia-snail-update-module-cache + "d" #'julia-snail-doc-lookup + (:prefix ("e" . "eval") + "b" #'julia-snail-send-buffer-file + "l" #'julia-snail-send-line + "r" #'julia-snail-send-region + "e" #'julia-snail-send-dwim)) + (:map (julia-snail-repl-mode-map) + "a" #'julia-snail-package-activate + "d" #'julia-snail-doc-lookup + "m" #'julia-snail-repl-go-back + "r" #'julia-snail-update-module-cache)))) diff --git a/modules/lang/julia/doctor.el b/modules/lang/julia/doctor.el index 536ff58a2..547f9f7c2 100644 --- a/modules/lang/julia/doctor.el +++ b/modules/lang/julia/doctor.el @@ -21,3 +21,5 @@ "-e" "using LanguageServer, SymbolServer"))))) (unless (zerop (car (apply #'doom-call-process args))) (warn! "Couldn't find LanguageServer.jl and/or SymbolServer.jl")))) + +;; TODO Check for snail diff --git a/modules/lang/julia/packages.el b/modules/lang/julia/packages.el index 8ddcf59ab..50f36c8fe 100644 --- a/modules/lang/julia/packages.el +++ b/modules/lang/julia/packages.el @@ -1,10 +1,13 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/julia/packages.el -(package! julia-mode :pin "7aafa8e77df64a47fa4729a0c1ea572b5bc8e30e") -(package! julia-repl :pin "57a15dfafed680ad7d81f779d414e8cb6717417c") +(package! julia-mode :pin "7a8c868e0d3e51ba4a2c621ee22ca9599e0e4bbb") +(package! julia-repl :pin "9503ef7110732e444e686e815c5b2ae8228d274d") (when (modulep! +lsp) (if (modulep! :tools lsp +eglot) - (package! eglot-jl :pin "2e04597223553a369dd5b6520b6365b41e6ea508") - (package! lsp-julia :pin "d6688bb131ff4a5a0201f6d3826ef0b018265389"))) + (package! eglot-jl :pin "7dc604fe42a459a987853d065cd6d0f3c4cbc02a") + (package! lsp-julia :pin "c584f79c7fee6176bbb6120f4cb0f1001bcf8113"))) + +(when (modulep! +snail) + (package! julia-snail :pin "18b891b4569096d541e996cf7e24da01efdf2e03"))