From e391f728c3a00215d8d32ac9b54b29961da46774 Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Mon, 12 Jun 2023 19:56:50 -0400 Subject: [PATCH] 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-sort-submitter, debbugs-gnu-sort-title): Remove DEFAULT argument of alist-get and instead wrap call with 'or' to return default. * debbugs-org.el (debbugs-org-show-reports): If the subject is empty, use the empty string. --- debbugs-gnu.el | 12 ++++++------ debbugs-org.el | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/debbugs-gnu.el b/debbugs-gnu.el index 81297d8b7f..dae87c75b0 100644 --- a/debbugs-gnu.el +++ b/debbugs-gnu.el @@ -1282,10 +1282,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)) @@ -1303,14 +1303,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) diff --git a/debbugs-org.el b/debbugs-org.el index 3d353c81e4..c3786d3b0e 100644 --- a/debbugs-org.el +++ b/debbugs-org.el @@ -209,9 +209,8 @@ marked as \"client-side filter\"." (archived (alist-get 'archived status)) (tags (append (alist-get 'found_versions status) (alist-get 'tags status))) - (subject (when (alist-get 'subject status) - (decode-coding-string - (alist-get 'subject status) 'utf-8))) + (subject (decode-coding-string + (or (alist-get 'subject status) "") 'utf-8)) (date (alist-get 'date status)) (last-modified (alist-get 'last_modified status)) (originator (when (alist-get 'originator status) -- 2.40.1