Ludovic Courtès (2014-09-06 00:24 +0400) wrote:

> BTW, M-x list-packages lists installed packages at the bottom, and with
> a different face.
>
> What about doing something similar for guix-newest-available-packages & co.?

No objection for a face, but I don't think such sorting should be the
default one.  I think it is done in "package.el" just because there is
no way to display only installed or obsolete packages there.

But as in "guix.el" we have "M-x guix-installed-packages" and "M-x
guix-obsolete-packages", in my opinion it would be better to leave the
current sorting by name.

Besides a user can easily sort a list by "Installed" column if he wants.
But of course if most people find such sort preferable, I will comply.

Here is the patch for a new face.  OK to push? (I'm never sure in a
commit message).

>From eafaf96cf86eb353aa414da6773254aca648e260 Mon Sep 17 00:00:00 2001
From: Alex Kost <alez...@gmail.com>
Date: Sat, 6 Sep 2014 12:08:42 +0400
Subject: [PATCH] emacs: Add a face for installed packages.

* emacs/guix-list.el (guix-package-list-installed): New face.
  (guix-package-list-get-name): Use it.
---
 emacs/guix-list.el | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index 0460d20..08fb3cb 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -448,6 +448,11 @@ This macro defines the following functions:
           (upgrade . ?U)
           (delete  . ?D)))
 
+(defface guix-package-list-installed
+  '((t :inherit guix-package-info-installed-outputs))
+  "Face used if there are installed outputs for the current package."
+  :group 'guix-package-list)
+
 (defface guix-package-list-obsolete
   '((t :inherit guix-package-info-obsolete))
   "Face used if a package is obsolete."
@@ -478,10 +483,13 @@ likely)."
 
 (defun guix-package-list-get-name (name entry)
   "Return NAME of the package ENTRY.
-Colorize it with `guix-package-list-obsolete' if needed."
+Colorize it with `guix-package-list-installed' or
+`guix-package-list-obsolete' if needed."
   (guix-get-string name
-                   (when (guix-get-key-val entry 'obsolete)
-                     'guix-package-list-obsolete)))
+                   (cond ((guix-get-key-val entry 'obsolete)
+                          'guix-package-list-obsolete)
+                         ((guix-get-key-val entry 'installed)
+                          'guix-package-list-installed))))
 
 (defun guix-package-list-get-installed-outputs (installed &optional _)
   "Return string with outputs from INSTALLED entries."
-- 
2.1.0

Reply via email to