aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-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