Skip to content

Commit c3ffcaf

Browse files
committed
Annotate defcustoms and minor refactorings
1 parent beb96dc commit c3ffcaf

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

nix-store.el

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,10 @@ respectively. The LABEL is the text displayed."
124124
(magit-insert-heading ,label)
125125
(cl-loop for x in value
126126
for exists = (file-exists-p x)
127+
for face = (if exists 'nix-store-path-realised-face 'nix-store-path-unrealised-face)
127128
do
128129
(magit-insert-section (store-path x)
129-
(insert
130-
(propertize x 'face (if exists 'nix-store-path-realised-face 'nix-store-path-unrealised-face))
131-
?\n)))
130+
(insert (propertize x 'face face) ?\n)))
132131
(insert ?\n)
133132
(magit-insert-child-count (magit-current-section))))))
134133

@@ -161,6 +160,7 @@ respectively. The LABEL is the text displayed."
161160
A list of function that each take one argument, the store path object."
162161
:group 'nix-store
163162
:type 'hook
163+
:package-version '(nix-mode . "1.5.0")
164164
:options '(nix-store-path-insert-path
165165
nix-store-path-insert-status
166166
nix-store-path-insert-hash
@@ -175,7 +175,8 @@ A list of function that each take one argument, the store path object."
175175
"Hook run to insert sections into a nix-store buffer.
176176
A list of function that each take one argument, the store path object."
177177
:group 'nix-store
178-
:type 'hook)
178+
:type 'hook
179+
:package-version '(nix-mode . "1.5.0"))
179180

180181
(defun nix-store-show-path (path)
181182
"Show a nix-store PATH.
@@ -214,10 +215,9 @@ It uses \\[nix-store-show-path] to display the store path."
214215
(defun nix-store-show-log ()
215216
"Opens the log file for the derivation of the nix-store path."
216217
(interactive)
217-
(let ((drv-path (car (nix-store-path-derivers nix-buffer-store-path))))
218-
(if (not drv-path)
219-
(message "This store path has no associated derivation.")
220-
(find-file (nix-log-path drv-path)))))
218+
(if-let ((drv-path (car (nix-store-path-derivers nix-buffer-store-path))))
219+
(find-file (nix-log-path drv-path))
220+
(user-error "This store path has no associated derivation.")))
221221

222222
(defvar nix-store-path-mode-map
223223
(let ((map (make-sparse-keymap)))
@@ -230,6 +230,7 @@ It uses \\[nix-store-show-path] to display the store path."
230230
(nix-store-show-path (nix-store-path-path nix-buffer-store-path)))
231231

232232
(define-derived-mode nix-store-path-mode magit-section-mode "Nix Store Path"
233+
:group 'nix-store
233234
(setq-local revert-buffer-function #'nix-store--revert-buffer-function)
234235
(read-only-mode 1))
235236

0 commit comments

Comments
 (0)