2018-08-31 17:47:45 +00:00
|
|
|
;;; packages.el --- Pact Layer packages File for Spacemacs
|
|
|
|
;;
|
2018-08-31 22:20:21 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2018-08-31 17:47:45 +00:00
|
|
|
;;
|
|
|
|
;; Author: Colin Woodbury <colin@kadena.io>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2018-09-05 16:55:24 +00:00
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2018-08-31 17:47:45 +00:00
|
|
|
(defconst pact-packages
|
|
|
|
'(
|
2018-08-31 22:57:22 +00:00
|
|
|
flycheck
|
2018-09-28 14:44:47 +00:00
|
|
|
flycheck-pact
|
2018-09-20 20:53:46 +00:00
|
|
|
pact-mode
|
2018-08-31 17:47:45 +00:00
|
|
|
))
|
|
|
|
|
2018-08-31 22:57:22 +00:00
|
|
|
(defun pact/post-init-flycheck ()
|
2018-09-05 16:55:24 +00:00
|
|
|
"Initialize flycheck."
|
2018-08-31 22:57:22 +00:00
|
|
|
(spacemacs/enable-flycheck 'pact-mode))
|
|
|
|
|
|
|
|
(defun pact/init-flycheck-pact ()
|
2018-09-05 16:55:24 +00:00
|
|
|
"Initialize flycheck-pact."
|
2018-09-20 20:53:46 +00:00
|
|
|
(use-package flycheck-pact
|
|
|
|
:commands flycheck-pact-interactive-buffer
|
|
|
|
:init (add-hook 'flycheck-mode-hook 'flycheck-pact-interactive-buffer)))
|
2018-08-31 17:47:45 +00:00
|
|
|
|
|
|
|
(defun pact/init-pact-mode ()
|
2018-09-05 16:55:24 +00:00
|
|
|
"Initialize pact-mode."
|
2018-08-31 17:47:45 +00:00
|
|
|
(use-package pact-mode
|
|
|
|
:defer t
|
|
|
|
|
2018-08-31 22:20:21 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/register-repl 'pact-mode 'spacemacs/pact-repl "pact"))
|
2018-08-31 17:47:45 +00:00
|
|
|
|
2018-08-31 22:20:21 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(defun spacemacs/pact-repl ()
|
|
|
|
"Open a pact repl in a side frame."
|
|
|
|
(interactive)
|
|
|
|
(if (get-buffer-process inferior-lisp-buffer)
|
|
|
|
;; Borrowed from `switch-to-lisp':
|
|
|
|
(let ((pop-up-frames
|
|
|
|
;; Be willing to use another frame
|
|
|
|
;; that already has the window in it.
|
|
|
|
(or pop-up-frames
|
|
|
|
(get-buffer-window inferior-lisp-buffer t))))
|
|
|
|
(pop-to-buffer inferior-lisp-buffer))
|
|
|
|
(progn
|
|
|
|
(spacemacs/new-empty-buffer-right)
|
|
|
|
(pact-mode)
|
|
|
|
(run-lisp inferior-lisp-program))))
|
2018-08-31 17:47:45 +00:00
|
|
|
|
2018-08-31 22:20:21 +00:00
|
|
|
(defun spacemacs/pact-load-file ()
|
|
|
|
"Load the current buffer into the Pact repl, optionally starting
|
|
|
|
the repl if it hasn't yet been."
|
|
|
|
(interactive)
|
|
|
|
(let ((curr (current-buffer)))
|
|
|
|
(progn
|
|
|
|
(unless (get-buffer-process inferior-lisp-buffer)
|
|
|
|
(spacemacs/pact-repl)
|
|
|
|
(pop-to-buffer curr))
|
|
|
|
(pact-load-file nil)
|
|
|
|
(pop-to-buffer curr))))
|
2018-08-31 17:47:45 +00:00
|
|
|
|
2018-08-31 22:20:21 +00:00
|
|
|
(dolist (prefix '(("ms" . "repl")))
|
|
|
|
(spacemacs/declare-prefix-for-mode 'pact-mode (car prefix) (cdr prefix)))
|
2018-08-31 17:47:45 +00:00
|
|
|
|
2018-08-31 22:20:21 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'pact-mode
|
|
|
|
;; REPL
|
|
|
|
"s'" 'spacemacs/pact-repl
|
|
|
|
"sb" 'spacemacs/pact-load-file))))
|
2018-09-05 16:55:24 +00:00
|
|
|
|
|
|
|
;;; packages.el ends here
|