This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/pact/packages.el

81 lines
2.2 KiB
EmacsLisp
Raw Normal View History

;;; packages.el --- Pact Layer packages File for Spacemacs
;;
2018-08-31 22:20:21 +00:00
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; 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:
(defconst pact-packages
'(
2018-08-31 22:57:22 +00:00
flycheck
flycheck-pact
2018-09-20 20:53:46 +00:00
pact-mode
))
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)))
(defun pact/init-pact-mode ()
2018-09-05 16:55:24 +00:00
"Initialize pact-mode."
(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 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 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 22:20:21 +00:00
(dolist (prefix '(("ms" . "repl")))
(spacemacs/declare-prefix-for-mode 'pact-mode (car prefix) (cdr prefix)))
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