2018-08-11 03:31:29 +00:00
|
|
|
|
;;; funcs.el --- Julia Layer functions File for Spacemacs
|
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2018-08-11 03:31:29 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Author: Adam Beckmeyer <adam_git@thebeckmeyers.xyz>
|
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
|
;;
|
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
;;
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
;;
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
2018-08-11 03:31:29 +00:00
|
|
|
|
|
2019-09-30 04:49:44 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs//julia-setup-backend ()
|
|
|
|
|
"Conditionally setup julia backend."
|
2021-03-18 04:26:36 +00:00
|
|
|
|
(when (eq julia-backend 'lsp)
|
|
|
|
|
(spacemacs//julia-setup-lsp)))
|
2019-09-30 04:49:44 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs//julia-setup-buffer ()
|
2020-04-08 22:22:23 +00:00
|
|
|
|
"Configure julia-mode"
|
2021-03-18 04:26:36 +00:00
|
|
|
|
(unless julia-mode-enable-ess
|
2019-09-30 04:49:44 +00:00
|
|
|
|
(spacemacs//julia-setup-repl)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; lsp
|
|
|
|
|
|
|
|
|
|
(defun spacemacs//julia-setup-lsp ()
|
|
|
|
|
"Start lsp-mode and configure for buffer."
|
|
|
|
|
(if (configuration-layer/layer-used-p 'lsp)
|
2021-06-06 20:25:00 +00:00
|
|
|
|
(lsp-deferred)
|
2019-09-30 04:49:44 +00:00
|
|
|
|
(message "`lsp' layer is not installed, please add `lsp' layer to your dotfile.")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; repl
|
|
|
|
|
|
|
|
|
|
(defun spacemacs//julia-setup-repl ()
|
|
|
|
|
"Start julia-repl minor mode and configure for buffer."
|
|
|
|
|
(julia-repl-mode))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; misc
|
|
|
|
|
|
2019-09-08 09:52:04 +00:00
|
|
|
|
(defun spacemacs//julia-hash-to-alist (hash)
|
|
|
|
|
"Convert a `hash-table' to an `alist' for the use in a helm buffer."
|
|
|
|
|
(let (res)
|
|
|
|
|
(maphash (lambda (key value)
|
|
|
|
|
(push `(,key . ,value) res))
|
|
|
|
|
hash)
|
|
|
|
|
res))
|
|
|
|
|
|
|
|
|
|
(when (configuration-layer/layer-used-p 'helm)
|
2021-02-10 07:51:55 +00:00
|
|
|
|
(defun spacemacs//julia-helm-math-insert ()
|
2019-09-08 09:52:04 +00:00
|
|
|
|
"Insert a utf8 symbol from `julia-latexsubs'"
|
|
|
|
|
(interactive)
|
|
|
|
|
(helm :sources (helm-build-sync-source "test"
|
|
|
|
|
:candidates (spacemacs//julia-hash-to-alist julia-latexsubs)
|
|
|
|
|
:fuzzy-match t
|
|
|
|
|
:action (lambda (candidate) (insert candidate)))
|
|
|
|
|
:buffer "*helm julia latex insert*")))
|