Refactor julia module
This commit is contained in:
parent
d6fe5dad65
commit
cd156fcc0a
1 changed files with 21 additions and 24 deletions
|
@ -3,28 +3,21 @@
|
||||||
(use-package! julia-mode
|
(use-package! julia-mode
|
||||||
:interpreter "julia"
|
:interpreter "julia"
|
||||||
:config
|
:config
|
||||||
|
|
||||||
(when (featurep! +lsp)
|
|
||||||
(add-hook 'julia-mode-hook #'lsp!)
|
|
||||||
(setq lsp-julia-default-environment "~/.julia/environments/v1.0")
|
|
||||||
)
|
|
||||||
|
|
||||||
(set-repl-handler! 'julia-mode #'+julia/open-repl)
|
(set-repl-handler! 'julia-mode #'+julia/open-repl)
|
||||||
(add-hook 'julia-mode-hook #'julia-repl-mode)
|
|
||||||
|
|
||||||
;; Borrow matlab.el's fontification of math operators
|
;; Borrow matlab.el's fontification of math operators. From
|
||||||
;; From <https://ogbe.net/emacsconfig.html>
|
;; <https://ogbe.net/emacsconfig.html>
|
||||||
(dolist (mode '(julia-mode ess-julia-mode))
|
(dolist (mode '(julia-mode ess-julia-mode))
|
||||||
(font-lock-add-keywords
|
(font-lock-add-keywords
|
||||||
mode
|
mode
|
||||||
`((,(let ((OR "\\|"))
|
`((,(let ((OR "\\|"))
|
||||||
(concat "\\(" ;; stolen `matlab.el' operators first
|
(concat "\\(" ; stolen `matlab.el' operators first
|
||||||
"[<>!]=?" OR
|
"[<>!]=?" OR
|
||||||
"\\.[/*^']" OR
|
"\\.[/*^']" OR
|
||||||
"==" OR
|
"==" OR
|
||||||
"=>" OR
|
"=>" OR
|
||||||
"\\<xor\\>" OR
|
"\\<xor\\>" OR
|
||||||
"[-+*\\/^&|$]=?" OR ;; this has to come before next (updating operators)
|
"[-+*\\/^&|$]=?" OR ; this has to come before next (updating operators)
|
||||||
"[-!^&|*+\\/~:]" OR
|
"[-!^&|*+\\/~:]" OR
|
||||||
;; more extra julia operators follow
|
;; more extra julia operators follow
|
||||||
"[%$]" OR
|
"[%$]" OR
|
||||||
|
@ -37,24 +30,28 @@
|
||||||
1 font-lock-type-face)))))
|
1 font-lock-type-face)))))
|
||||||
|
|
||||||
|
|
||||||
(after! julia-repl
|
(use-package! julia-repl
|
||||||
(add-hook 'julia-repl-hook #'julia-repl-use-emacsclient)
|
:hook (julia-repl-mode . julia-repl-use-emacsclient)
|
||||||
|
:config
|
||||||
(defadvice! julia-repl--buffer-name (&optional executable-key suffix)
|
|
||||||
:override #'julia-repl--inferior-buffer-name
|
|
||||||
"Name for a Julia REPL inferior buffer. Uses workspace name for doom emacs"
|
|
||||||
(concat julia-repl-inferior-buffer-name-base ":" (+workspace-current-name)))
|
|
||||||
|
|
||||||
(set-popup-rule! "^\\*julia.*\\*$" :ttl nil)
|
(set-popup-rule! "^\\*julia.*\\*$" :ttl nil)
|
||||||
|
|
||||||
(defadvice! after-julia-repl-advice (inferior-buffer)
|
(when (featurep! :ui workspaces)
|
||||||
|
(defadvice! +julia--namespace-repl-buffer-to-workspace-a (&optional executable-key suffix)
|
||||||
|
"Name for a Julia REPL inferior buffer. Uses workspace name for doom emacs"
|
||||||
|
:override #'julia-repl--inferior-buffer-name
|
||||||
|
(concat julia-repl-inferior-buffer-name-base ":" (+workspace-current-name))))
|
||||||
|
|
||||||
|
(defadvice! +julia--override-repl-escape-char-a (inferior-buffer)
|
||||||
|
"Use C-c instead of C-x for escaping."
|
||||||
:after #'julia-repl--setup-term
|
:after #'julia-repl--setup-term
|
||||||
(with-current-buffer inferior-buffer
|
(with-current-buffer inferior-buffer
|
||||||
(term-set-escape-char ?\C-c) ; override default of C-x..
|
(term-set-escape-char ?\C-c))))
|
||||||
))
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package! lsp-julia
|
(use-package! lsp-julia
|
||||||
:when (featurep! +lsp)
|
:when (featurep! +lsp)
|
||||||
:after lsp-clients
|
:after lsp-clients
|
||||||
)
|
:preface
|
||||||
|
(setq lsp-julia-default-environment "~/.julia/environments/v1.0")
|
||||||
|
(when (featurep! +lsp)
|
||||||
|
(add-hook 'julia-mode-local-vars-hook #'lsp!)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue