summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/guix-command.el29
-rw-r--r--emacs/guix-devel.el107
-rw-r--r--emacs/guix-external.el2
-rw-r--r--emacs/guix-init.el4
4 files changed, 129 insertions, 13 deletions
diff --git a/emacs/guix-command.el b/emacs/guix-command.el
index b679ad9b1e..1a42594b68 100644
--- a/emacs/guix-command.el
+++ b/emacs/guix-command.el
@@ -249,7 +249,8 @@ to be modified."
(guix-command-define-argument-improver
guix-command-improve-system-argument
- '(("vm-image" :char ?V)
+ '(("disk-image" :char ?D)
+ ("vm-image" :char ?V)
("--on-error" :char ?E)
("--no-grub" :char ?g)
("--full-boot" :char ?b)))
@@ -498,15 +499,17 @@ to be modified."
"List of default 'execute' action arguments.")
(defvar guix-command-additional-execute-arguments
- `((("build")
- ,(guix-command-make-argument
- :name "log" :char ?l :doc "View build log"))
- (("graph")
- ,(guix-command-make-argument
- :name "view" :char ?v :doc "View graph"))
- (("size")
- ,(guix-command-make-argument
- :name "view" :char ?v :doc "View map")))
+ (let ((graph-arg (guix-command-make-argument
+ :name "view" :char ?v :doc "View graph")))
+ `((("build")
+ ,(guix-command-make-argument
+ :name "log" :char ?l :doc "View build log"))
+ (("graph") ,graph-arg)
+ (("size")
+ ,(guix-command-make-argument
+ :name "view" :char ?v :doc "View map"))
+ (("system" "dmd-graph") ,graph-arg)
+ (("system" "extension-graph") ,graph-arg)))
"Alist of guix commands and additional 'execute' action arguments.")
(defun guix-command-execute-arguments (commands)
@@ -530,7 +533,11 @@ to be modified."
(("graph")
("view" . guix-run-view-graph))
(("size")
- ("view" . guix-run-view-size-map)))
+ ("view" . guix-run-view-size-map))
+ (("system" "dmd-graph")
+ ("view" . guix-run-view-graph))
+ (("system" "extension-graph")
+ ("view" . guix-run-view-graph)))
"Alist of guix commands and alists of special executers for them.
See also `guix-command-default-executors'.")
diff --git a/emacs/guix-devel.el b/emacs/guix-devel.el
index b8330289c5..f3ad4b9255 100644
--- a/emacs/guix-devel.el
+++ b/emacs/guix-devel.el
@@ -24,6 +24,7 @@
;;; Code:
+(require 'lisp-mode)
(require 'guix-guile)
(require 'guix-geiser)
(require 'guix-utils)
@@ -177,9 +178,52 @@ to find 'modify-phases' keywords."
(ignore-errors (forward-sexp))
(save-excursion (up-list) (point)))))
+(defconst guix-devel-keywords
+ '("call-with-compressed-output-port"
+ "call-with-container"
+ "call-with-decompressed-port"
+ "call-with-derivation-narinfo"
+ "call-with-derivation-substitute"
+ "call-with-error-handling"
+ "call-with-temporary-directory"
+ "call-with-temporary-output-file"
+ "define-enumerate-type"
+ "define-gexp-compiler"
+ "define-lift"
+ "define-monad"
+ "define-operation"
+ "define-record-type*"
+ "emacs-substitute-sexps"
+ "emacs-substitute-variables"
+ "mbegin"
+ "mlet"
+ "mlet*"
+ "munless"
+ "mwhen"
+ "run-with-state"
+ "run-with-store"
+ "signature-case"
+ "substitute*"
+ "substitute-keyword-arguments"
+ "test-assertm"
+ "use-package-modules"
+ "use-service-modules"
+ "use-system-modules"
+ "with-atomic-file-output"
+ "with-atomic-file-replacement"
+ "with-derivation-narinfo"
+ "with-derivation-substitute"
+ "with-directory-excursion"
+ "with-error-handling"
+ "with-monad"
+ "with-mutex"
+ "with-store"))
+
(defvar guix-devel-font-lock-keywords
`((,(rx (or "#~" "#$" "#$@" "#+" "#+@")) .
'guix-devel-gexp-symbol)
+ (,(guix-guile-keyword-regexp (regexp-opt guix-devel-keywords))
+ (1 'font-lock-keyword-face))
(,(guix-guile-keyword-regexp "modify-phases")
(1 'font-lock-keyword-face)
(guix-devel-modify-phases-font-lock-matcher
@@ -189,6 +233,69 @@ to find 'modify-phases' keywords."
"A list of `font-lock-keywords' for `guix-devel-mode'.")
+;;; Indentation
+
+(defmacro guix-devel-scheme-indent (&rest rules)
+ "Set `scheme-indent-function' according to RULES.
+Each rule should have a form (SYMBOL VALUE). See `put' for details."
+ (declare (indent 0))
+ `(progn
+ ,@(mapcar (lambda (rule)
+ `(put ',(car rule) 'scheme-indent-function ,(cadr rule)))
+ rules)))
+
+(defun guix-devel-indent-package (state indent-point normal-indent)
+ "Indentation rule for 'package' form."
+ (let* ((package-eol (line-end-position))
+ (count (if (and (ignore-errors (down-list) t)
+ (< (point) package-eol)
+ (looking-at "inherit\\>"))
+ 1
+ 0)))
+ (lisp-indent-specform count state indent-point normal-indent)))
+
+(guix-devel-scheme-indent
+ (bag 0)
+ (build-system 0)
+ (call-with-compressed-output-port 2)
+ (call-with-container 1)
+ (call-with-decompressed-port 2)
+ (call-with-error-handling 0)
+ (container-excursion 1)
+ (emacs-batch-edit-file 1)
+ (emacs-batch-eval 0)
+ (emacs-substitute-sexps 1)
+ (emacs-substitute-variables 1)
+ (file-system 0)
+ (graft 0)
+ (manifest-entry 0)
+ (manifest-pattern 0)
+ (mbegin 1)
+ (mlet 2)
+ (mlet* 2)
+ (modify-phases 1)
+ (munless 1)
+ (mwhen 1)
+ (operating-system 0)
+ (origin 0)
+ (package 'guix-devel-indent-package)
+ (run-with-state 1)
+ (run-with-store 1)
+ (signature-case 1)
+ (substitute* 1)
+ (substitute-keyword-arguments 1)
+ (test-assertm 1)
+ (with-atomic-file-output 1)
+ (with-derivation-narinfo 1)
+ (with-derivation-substitute 2)
+ (with-directory-excursion 1)
+ (with-error-handling 0)
+ (with-monad 1)
+ (with-mutex 1)
+ (with-store 1)
+ (wrap-program 1))
+
+
(defvar guix-devel-keys-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "b") 'guix-devel-build-package-definition)
diff --git a/emacs/guix-external.el b/emacs/guix-external.el
index d233473abe..580676ef91 100644
--- a/emacs/guix-external.el
+++ b/emacs/guix-external.el
@@ -64,7 +64,7 @@ If ARGS is nil, use `guix-dot-default-arguments'."
"Return '.png' file name in the `temporary-file-directory'."
(concat (make-temp-name
(concat (file-name-as-directory temporary-file-directory)
- "graph-"))
+ "guix-emacs-graph-"))
".png"))
(provide 'guix-external)
diff --git a/emacs/guix-init.el b/emacs/guix-init.el
index 96aa0c2ffc..4b3d9c281c 100644
--- a/emacs/guix-init.el
+++ b/emacs/guix-init.el
@@ -1,4 +1,5 @@
(require 'guix-autoloads)
+(require 'guix-emacs)
(defcustom guix-package-enable-at-startup t
"If non-nil, activate Emacs packages installed in a user profile.
@@ -8,8 +9,9 @@ avoid loading autoloads of Emacs packages installed in
:type 'boolean
:group 'guix)
+(add-to-list 'load-path (guix-emacs-directory))
+
(when guix-package-enable-at-startup
- (require 'guix-emacs)
(guix-emacs-load-autoloads 'all))
(add-hook 'scheme-mode-hook 'guix-devel-activate-mode-maybe)