mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
emacs: Improve messages for packages found by ID.
* emacs/guix-messages.el (guix-message-packages-by-id): New procedure. (guix-messages): Use it.
This commit is contained in:
parent
87fe9ecae5
commit
fc7a28897c
1 changed files with 20 additions and 6 deletions
|
@ -31,9 +31,8 @@
|
|||
(defvar guix-messages
|
||||
`((package
|
||||
(id
|
||||
(0 "Packages not found.")
|
||||
(1 "")
|
||||
(many "%d packages." count))
|
||||
,(lambda (_ entries ids)
|
||||
(guix-message-packages-by-id entries 'package ids)))
|
||||
(name
|
||||
,(lambda (_ entries names)
|
||||
(guix-message-packages-by-name entries 'package names)))
|
||||
|
@ -67,9 +66,8 @@
|
|||
|
||||
(output
|
||||
(id
|
||||
(0 "Package outputs not found.")
|
||||
(1 "")
|
||||
(many "%d package outputs." count))
|
||||
,(lambda (_ entries ids)
|
||||
(guix-message-packages-by-id entries 'output ids)))
|
||||
(name
|
||||
,(lambda (_ entries names)
|
||||
(guix-message-packages-by-name entries 'output names)))
|
||||
|
@ -147,6 +145,22 @@
|
|||
(guix-message-string-entry-type
|
||||
entry-type 'plural)))))
|
||||
|
||||
(defun guix-message-packages-by-id (entries entry-type ids)
|
||||
"Display a message for packages or outputs searched by IDS."
|
||||
(let* ((count (length entries))
|
||||
(str-beg (guix-message-string-entries count entry-type))
|
||||
(str-end (if (> count 1)
|
||||
(concat "with the following IDs: "
|
||||
(mapconcat #'guix-get-string ids ", "))
|
||||
(concat "with ID " (guix-get-string (car ids))))))
|
||||
(if (zerop count)
|
||||
(message "%s %s.
|
||||
Most likely, Guix REPL was restarted, so IDs are not actual
|
||||
anymore, because they live only during the REPL process.
|
||||
Try \"M-x guix-search-by-name\"."
|
||||
str-beg str-end)
|
||||
(message "%s %s." str-beg str-end))))
|
||||
|
||||
(defun guix-message-packages-by-name (entries entry-type names)
|
||||
"Display a message for packages or outputs searched by NAMES."
|
||||
(let* ((count (length entries))
|
||||
|
|
Loading…
Reference in a new issue