2018-08-11 03:31:29 +00:00
|
|
|
;;; funcs.el --- Julia Layer functions File for Spacemacs
|
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
|
|
|
;;
|
|
|
|
;; Author: Adam Beckmeyer <adam_git@thebeckmeyers.xyz>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
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)
|
|
|
|
(defun spacemacs//julia-helm-math-insert()
|
|
|
|
"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*")))
|
|
|
|
|
2018-08-11 03:31:29 +00:00
|
|
|
(defun spacemacs//julia-setup-buffer ()
|
|
|
|
"Setup ESS and/or lsp for buffer depending on config."
|
2018-12-15 15:58:55 +00:00
|
|
|
(when (not julia-mode-enable-ess)
|
|
|
|
(spacemacs//julia-setup-repl))
|
|
|
|
(when julia-mode-enable-lsp
|
|
|
|
(spacemacs//julia-setup-lsp)))
|
2018-08-11 03:31:29 +00:00
|
|
|
|
|
|
|
(defun spacemacs//julia-setup-repl ()
|
|
|
|
"Start julia-repl minor mode and configure for buffer."
|
|
|
|
(julia-repl-mode))
|
|
|
|
|
|
|
|
(defun spacemacs//julia-setup-lsp ()
|
|
|
|
"Start lsp-mode and configure for buffer."
|
|
|
|
(if (configuration-layer/layer-used-p 'lsp)
|
2018-12-15 15:58:55 +00:00
|
|
|
(lsp)
|
2018-08-11 03:31:29 +00:00
|
|
|
(message "`lsp' layer is not installed, please add `lsp' layer to your dotfile.")))
|