From 54a3e56379308c05a9ac6646160d136a26044b95 Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Mon, 12 Jun 2023 19:56:50 -0400 Subject: [PATCH 2/4] Don't error out on 'nil' alist value. The intention of the DEFAULT argument to alist-get is to return "" instead of 'nil'. However, this still returns 'nil' if the key exists but the value is 'nil'. This problem wasn't detected previously since the functions 'debbugs-gnu-sort-submitter' and 'debbugs-gnu-sort-title' weren't actually used until the previous commit. * debbugs-gnu.el (debbugs-gnu-print-entry): (debbugs-gnu-sort-submitter): (debbugs-gnu-sort-title): Remove DEFAULT argument of alist-get and instead wrap call with 'or' to return default. --- debbugs-gnu.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/debbugs-gnu.el b/debbugs-gnu.el index 2c76a3361b..c28a4aa5e4 100644 --- a/debbugs-gnu.el +++ b/debbugs-gnu.el @@ -1062,7 +1062,7 @@ Used instead of `tabulated-list-print-entry'." (not (catch :suppress (dolist (check debbugs-gnu-default-suppress-bugs) (when (string-match - (cdr check) (alist-get (car check) list-id "")) + (cdr check) (or (alist-get (car check) list-id) "")) (throw :suppress t)))))) ;; Filter search list. (not (catch :suppress @@ -1288,10 +1288,10 @@ Interactively, it is non-nil with the prefix argument." (defun debbugs-gnu-sort-submitter (s1 s2) (let ((address1 (debbugs-gnu--split-address - (decode-coding-string (alist-get 'originator (car s1) "") 'utf-8))) + (decode-coding-string (or (alist-get 'originator (car s1)) "") 'utf-8))) (address2 (debbugs-gnu--split-address - (decode-coding-string (alist-get 'originator (car s2) "") 'utf-8)))) + (decode-coding-string (or (alist-get 'originator (car s2)) "") 'utf-8)))) (cond ;; Bugs I'm the originator of go to the beginning. ((and (string-equal user-mail-address (car address1)) @@ -1309,14 +1309,14 @@ Interactively, it is non-nil with the prefix argument." (defun debbugs-gnu-sort-title (s1 s2) (let ((owner1 (car (debbugs-gnu--split-address - (decode-coding-string (alist-get 'owner (car s1) "") 'utf-8)))) + (decode-coding-string (or (alist-get 'owner (car s1)) "") 'utf-8)))) (subject1 - (decode-coding-string (alist-get 'subject (car s1) "") 'utf-8)) + (decode-coding-string (or (alist-get 'subject (car s1)) "") 'utf-8)) (owner2 (car (debbugs-gnu--split-address - (decode-coding-string (alist-get 'owner (car s2) "") 'utf-8)))) + (decode-coding-string (or (alist-get 'owner (car s2)) "") 'utf-8)))) (subject2 - (decode-coding-string (alist-get 'subject (car s2) "") 'utf-8))) + (decode-coding-string (or (alist-get 'subject (car s2)) "") 'utf-8))) (cond ;; Bugs I'm the owner of go to the beginning. ((and (string-equal user-mail-address owner1) -- 2.40.1