summaryrefslogtreecommitdiff
path: root/emacs/guix-devel.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-10-01 21:06:42 +0300
committerAlex Kost <alezost@gmail.com>2015-10-09 16:17:45 +0300
commit5952111cc035ae87d73c7100906534993a951ca1 (patch)
treeffca2c4dd1c5d473d31a8228fe2a22dcac1a58fb /emacs/guix-devel.el
parent5a60d56975a67facbea41cb97fb4903453bf0752 (diff)
emacs: Add 'guix-devel-with-definition'.
* emacs/guix-devel.el (guix-devel-with-definition): New macro. (guix-devel-build-package-definition): Use it. (guix-devel-emacs-font-lock-keywords): New variable.
Diffstat (limited to 'emacs/guix-devel.el')
-rw-r--r--emacs/guix-devel.el23
1 files changed, 20 insertions, 3 deletions
diff --git a/emacs/guix-devel.el b/emacs/guix-devel.el
index b51fcee459..7f758f55a8 100644
--- a/emacs/guix-devel.el
+++ b/emacs/guix-devel.el
@@ -94,12 +94,21 @@ Interactively, use the module defined by the current scheme file."
(guix-devel-setup-repl repl)
(push process guix-devel-repl-processes))))
+(defmacro guix-devel-with-definition (def-var &rest body)
+ "Run BODY with the current guile definition bound to DEF-VAR.
+Bind DEF-VAR variable to the name of the current top-level
+definition, setup the current REPL, use the current module, and
+run BODY."
+ (declare (indent 1) (debug (symbolp body)))
+ `(let ((,def-var (guix-guile-current-definition)))
+ (guix-devel-setup-repl-maybe)
+ (guix-devel-use-modules (guix-guile-current-module))
+ ,@body))
+
(defun guix-devel-build-package-definition ()
"Build a package defined by the current top-level variable definition."
(interactive)
- (let ((def (guix-guile-current-definition)))
- (guix-devel-setup-repl-maybe)
- (guix-devel-use-modules (guix-guile-current-module))
+ (guix-devel-with-definition def
(when (or (not guix-operation-confirm)
(guix-operation-prompt (format "Build '%s'?" def)))
(guix-geiser-eval-in-repl
@@ -196,6 +205,14 @@ bindings:
(when guix-devel-activate-mode
(guix-devel-mode)))
+
+(defvar guix-devel-emacs-font-lock-keywords
+ (eval-when-compile
+ `((,(rx "(" (group "guix-devel-with-definition") symbol-end) . 1))))
+
+(font-lock-add-keywords 'emacs-lisp-mode
+ guix-devel-emacs-font-lock-keywords)
+
(provide 'guix-devel)
;;; guix-devel.el ends here