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

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

[nongnu] elpa/pdf-tools 49078c71f1 2/5: Fix: misuse of cl-ecase


From: ELPA Syncer
Subject: [nongnu] elpa/pdf-tools 49078c71f1 2/5: Fix: misuse of cl-ecase
Date: Mon, 3 Oct 2022 05:59:03 -0400 (EDT)

branch: elpa/pdf-tools
commit 49078c71f1ae9e85e719029a3e5e5f5e10509017
Author: İ. Göktuğ Kayaalp <self@gkayaalp.com>
Commit: Vedang Manerikar <ved.manerikar@gmail.com>

    Fix: misuse of cl-ecase
    
    The `cl-ecase` macro does not support default cases (‘otherwise’ or
    ‘t’), and the cl-case macro requires the default case to be the last
    clause, which a recent change to Emacs rendered a macro expansion
    error[^1], thus preventing the module from loading (and potentially
    signalling error in the init process).
    
    Furthermore, `cl-ecase` expands to a `cl-case` form with a trailing
    special flag clause, so the appearance of a ‘t’ or ‘otherwise’ clause
    in a `cl-ecase` call will always result in this error being triggered.
    
    I thus replace the apparently futile call to `cl-ecase` with an
    equivalent null check and a call to `cl-case`, which fixes both issues.
    I replaced `cl-ecase` with `cl-case` because the former form had both a
    t-check and a nil-check, which meant the error case was impossible to
    be triggered.
    
    [^1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51368
    
    Closes: #159
    Closes: #154
    Closes: #157
---
 lisp/pdf-annot.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/pdf-annot.el b/lisp/pdf-annot.el
index 6126a6cd84..c82ed0cfb2 100644
--- a/lisp/pdf-annot.el
+++ b/lisp/pdf-annot.el
@@ -524,12 +524,12 @@ the variable is nil and this function is called again."
            (union (cl-union (cl-union changed inserted :test 'pdf-annot-equal)
                             deleted :test 'pdf-annot-equal))
            (closure (lambda (arg)
-                      (cl-ecase arg
-                        (:inserted (copy-sequence inserted))
-                        (:changed (copy-sequence changed))
-                        (:deleted (copy-sequence deleted))
-                        (t (copy-sequence union))
-                        (nil nil))))
+                      (when arg
+                        (cl-case arg
+                          (:inserted (copy-sequence inserted))
+                          (:changed (copy-sequence changed))
+                          (:deleted (copy-sequence deleted))
+                          (t (copy-sequence union))))))
            (pages (mapcar (lambda (a) (pdf-annot-get a 'page)) union)))
       (when union
         (unwind-protect



reply via email to

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