emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/debbugs 59f00ee268: Don't error out on 'nil' alist valu


From: Michael Albinus
Subject: [elpa] externals/debbugs 59f00ee268: Don't error out on 'nil' alist value
Date: Sun, 18 Jun 2023 07:13:03 -0400 (EDT)

branch: externals/debbugs
commit 59f00ee26894aca30ca45f6695418128bfd8eacc
Author: Morgan Smith <Morgan.J.Smith@outlook.com>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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.  (Bug#64064)
    
    * debbugs-org.el (debbugs-org-show-reports): If the subject is
    empty, use the empty string.
---
 debbugs-gnu.el | 16 ++++++++++------
 debbugs-org.el |  5 ++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 925d4bbd92..cbc310ae57 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -1293,10 +1293,12 @@ 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))
@@ -1314,14 +1316,16 @@ 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 be6af04a8e..2055a0faec 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]