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

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

[elpa] externals/embark 2aba953bf1: Don't rely on func-arity since advic


From: ELPA Syncer
Subject: [elpa] externals/embark 2aba953bf1: Don't rely on func-arity since advice can change it
Date: Thu, 10 Nov 2022 20:57:38 -0500 (EST)

branch: externals/embark
commit 2aba953bf11f01b8ac9b2f44d151335eaf09802f
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>

    Don't rely on func-arity since advice can change it
    
    It's not rare to have :around advice with parameter list of the
    form:(fn &rest args) which would change the return value of func-arity
    to (0 . many), so func-arity is not a reliable way to find out the
    number of arguments eww-download-callback takes. Thanks to Stefan
    Monnier for pointing this out.
    
    I did a quick check of Emacs versions and 27.2 still had the
    two-argument version of the function, whereas 28.0.90 has the
    three-argument version. So, following Stefan's suggestion, I'll check
    for emacs-major-version ≥ 28.
---
 embark.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/embark.el b/embark.el
index e29e83d9f7..76af12670a 100644
--- a/embark.el
+++ b/embark.el
@@ -3745,10 +3745,9 @@ ALGORITHM is the hash algorithm symbol understood by 
`secure-hash'."
   (let ((dir eww-download-directory))
     (when (functionp dir) (setq dir (funcall dir)))
     (access-file dir "Download failed")
-    (url-retrieve url #'eww-download-callback
-                  (if (= (car (func-arity #'eww-download-callback)) 3)
-                      (list url dir)
-                    (list url)))))
+    (url-retrieve
+     url #'eww-download-callback
+     (if (>= emacs-major-version 28) (list url dir) (list url)))))
 
 ;;; Setup and pre-action hooks
 



reply via email to

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