summary refs log tree commit diff
path: root/emacs/guix-messages.el
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-01-03 14:53:03 +0100
committerLudovic Courtès <ludo@gnu.org>2016-01-03 14:53:03 +0100
commit53334dd6e9e296e17110ebcd2b1f93f117ffe36a (patch)
tree2653db2eab9a204dab892ea8b6812cadf7209e84 /emacs/guix-messages.el
parent1575dcd134f4fae7255787293f4988bbd043de95 (diff)
parent51385362f76e2f823ac8d8cf720d06c386504069 (diff)
downloadguix-53334dd6e9e296e17110ebcd2b1f93f117ffe36a.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'emacs/guix-messages.el')
-rw-r--r--emacs/guix-messages.el26
1 files changed, 20 insertions, 6 deletions
diff --git a/emacs/guix-messages.el b/emacs/guix-messages.el
index 2bf99de6fa..eb2a76e216 100644
--- a/emacs/guix-messages.el
+++ b/emacs/guix-messages.el
@@ -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))