Purescript development tools
This commit is contained in:
parent
4d356b3a06
commit
4e8adcfafb
7 changed files with 104 additions and 32 deletions
|
@ -1,7 +1,8 @@
|
|||
|
||||
(use-package evil
|
||||
:init
|
||||
(setq evil-want-keybinding nil)
|
||||
:custom
|
||||
(evil-want-keybinding nil)
|
||||
(evil-undo-system 'undo-redo)
|
||||
:config
|
||||
(evil-mode 1) ; globally enable evil-mode except for the following modes
|
||||
(mapcar (lambda (mode) (evil-set-initial-state mode 'emacs))
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
|
||||
(global-set-key [f6] 'nixos-rebuild-test)
|
||||
|
||||
(provide 'nix)
|
||||
(provide 'config-nix)
|
47
users/profiles/emacs/emacs.d/config/config-purescript.el
Normal file
47
users/profiles/emacs/emacs.d/config/config-purescript.el
Normal file
|
@ -0,0 +1,47 @@
|
|||
(use-package psc-ide
|
||||
:custom
|
||||
(psc-ide-rebuild-on-save t)
|
||||
|
||||
:config
|
||||
;; The following is stolen from the Spacemacs purescript layer
|
||||
|
||||
(defun purescript-purs-tidy-format-buffer ()
|
||||
"Format buffer with purs-tidy."
|
||||
(interactive)
|
||||
(if (executable-find "purs-tidy")
|
||||
(let* ((extension (file-name-extension (or buffer-file-name "tmp.purs") t))
|
||||
(tmpfile (make-temp-file "~fmt-tmp" nil extension))
|
||||
(coding-system-for-read 'utf-8)
|
||||
(coding-system-for-write 'utf-8)
|
||||
(outputbuf (get-buffer-create "*~fmt-tmp.purs*")))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(with-current-buffer outputbuf (erase-buffer))
|
||||
(write-region nil nil tmpfile)
|
||||
(if (zerop (apply #'call-process-region nil nil "purs-tidy" nil
|
||||
`(,outputbuf ,tmpfile) nil
|
||||
`("format")))
|
||||
(let ((p (point)))
|
||||
(save-excursion
|
||||
(with-current-buffer (current-buffer)
|
||||
(replace-buffer-contents outputbuf)))
|
||||
(goto-char p)
|
||||
(message "formatted.")
|
||||
(kill-buffer outputbuf))
|
||||
(message "Formatting failed!")
|
||||
(display-buffer outputbuf)))
|
||||
(delete-file tmpfile)))
|
||||
(error "purs-tidy not found")))
|
||||
|
||||
:hook
|
||||
(before-save . purescript-purs-tidy-format-buffer)
|
||||
(purescript-mode . (lambda ()
|
||||
(psc-ide-mode)
|
||||
(company-mode)
|
||||
(flycheck-mode)
|
||||
(turn-on-purescript-indentation)
|
||||
)))
|
||||
|
||||
(use-package psci)
|
||||
|
||||
(provide 'config-purescript)
|
|
@ -24,6 +24,7 @@ Return nil if COMMAND is not found anywhere in `exec-path'."
|
|||
(require 'config-lsp)
|
||||
(require 'config-python)
|
||||
(require 'config-spelling)
|
||||
(require 'nix)
|
||||
(require 'config-nix)
|
||||
(require 'config-purescript)
|
||||
|
||||
(server-start)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue