From abc5b82971c1ab74c3e7df87bb1a49f63502f922 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Fri, 10 Oct 2014 23:29:24 +0400 Subject: 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. --- emacs/guix-list.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'emacs') 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." -- cgit 1.4.1