summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-10-10 23:29:24 +0400
committerAlex Kost <alezost@gmail.com>2014-10-12 08:47:19 +0400
commitabc5b82971c1ab74c3e7df87bb1a49f63502f922 (patch)
treea8a5562e93d704b6157cfd8ee41830c03bbb7eb6
parentb3bb82f1542ec0805b87305482829102f2faaa92 (diff)
downloadguix-abc5b82971c1ab74c3e7df87bb1a49f63502f922.tar.gz
emacs: Allow list functions to deal with nil values.
* emacs/guix-list.el (guix-list-get-tabulated-entry): Call functions returning
  column value even for nil values.
  (guix-list-get-one-line): Adjust for accepting nil argument.
-rw-r--r--emacs/guix-list.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index 4b4b9c5396..9cc381b4be 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -182,13 +182,16 @@ Parameters are taken from ENTRY of ENTRY-TYPE."
      (let ((val (guix-get-key-val entry param))
            (fun (guix-get-key-val guix-list-column-value-methods
                                   entry-type param)))
-       (if (and val fun)
+       (if fun
            (funcall fun val entry)
          (guix-get-string val))))))
 
-(defun guix-list-get-one-line (str &optional _)
-  "Return one-line string from a multi-line STR."
-  (guix-get-one-line str))
+(defun guix-list-get-one-line (val &optional _)
+  "Return one-line string from a multi-line string VAL.
+VAL may be nil."
+  (if val
+      (guix-get-one-line val)
+    (guix-get-string nil)))
 
 (defun guix-list-get-time (seconds &optional _)
   "Return formatted time string from SECONDS."