[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 021ffd1 59/99: Handle legacy bytecode argument l
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 021ffd1 59/99: Handle legacy bytecode argument lists |
Date: |
Sun, 17 Oct 2021 05:57:57 -0400 (EDT) |
branch: externals/compat
commit 021ffd154d8282b6114f108b433f0672d98ccff3
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Handle legacy bytecode argument lists
This appears to be necessary for some versions of Emacs 24.x.
---
compat.el | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/compat.el b/compat.el
index ed2c118..cc5adee 100644
--- a/compat.el
+++ b/compat.el
@@ -105,13 +105,35 @@ advice."
(setq min-args (1+ min-args)))
(setq max-args (1+ max-args)))))
(cons min-args max-args))))
- ((byte-code-function-p func)
+ ((and (byte-code-function-p func) (numberp (aref func 0)))
;; See get_byte_code_arity from bytecode.c
(let ((at (aref func 0)))
(cons (logand at 127)
(if (= (logand at 128) 0)
(ash at -8)
'many))))
+ ((and (byte-code-function-p func) (numberp (aref func 0)))
+ ;; See get_byte_code_arity from bytecode.c
+ (let ((at (aref func 0)))
+ (cons (logand at 127)
+ (if (= (logand at 128) 0)
+ (ash at -8)
+ 'many))))
+ ((and (byte-code-function-p func) (listp (aref func 0)))
+ ;; Based on `byte-compile-make-args-desc', this is required for
+ ;; old versions of Emacs that don't use a integer for the argument
+ ;; list description, per e2abe5a13dffb08d6371b6a611bc39c3a9ac2bc6.
+ (let ((arglist (aref func 0)) (mandatory 0) nonrest)
+ (while (and arglist (not (memq (car arglist) '(&optional &rest))))
+ (setq mandatory (1+ mandatory))
+ (setq arglist (cdr arglist)))
+ (setq nonrest mandatory)
+ (when (eq (car arglist) '&optional)
+ (setq arglist (cdr arglist))
+ (while (and arglist (not (eq (car arglist) '&rest)))
+ (setq nonrest (1+ nonrest))
+ (setq arglist (cdr arglist))))
+ (cons mandatory (if arglist 'many nonrest))))
((autoloadp func)
(autoload-do-load func)
(compat-func-arity func))
- [elpa] externals/compat 1d0f6db 56/99: Add compat-if-let* tests, (continued)
- [elpa] externals/compat 1d0f6db 56/99: Add compat-if-let* tests, ELPA Syncer, 2021/10/17
- [elpa] externals/compat c0c1889 57/99: Add compat-and-let* tests, ELPA Syncer, 2021/10/17
- [elpa] externals/compat a57cfed 66/99: Avoid comparing alist-get with testfn if not available, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 7d90061 21/99: Add made up macro name to macrop test, ELPA Syncer, 2021/10/17
- [elpa] externals/compat f3c5728 22/99: Wrap compat-tests setup in an eval-and-load block, ELPA Syncer, 2021/10/17
- [elpa] externals/compat eb0c027 26/99: Advise indirect-function to not raise void-function, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 797930f 34/99: Declare temporary-file-directory for make-nearby-temp-file, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 26acf1f 48/99: Use compatibility macros in ...-let definitions, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 8f64282 49/99: Use compatibility functions in string-trim definition, ELPA Syncer, 2021/10/17
- [elpa] externals/compat e6b5f08 53/99: Load all compatibility code unconditionally, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 021ffd1 59/99: Handle legacy bytecode argument lists,
ELPA Syncer <=
- [elpa] externals/compat 956db9b 60/99: Improve handling of conditional compatibility definitions, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 9be46b0 16/99: Add check for Emacs 28 to compat-tests.el, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 10ef8f4 36/99: Declare string-trim-left and directory-name-p, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 9df8e0c 38/99: Add GitHub action file for CI, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 4364563 43/99: Use unprefixed symbols where possible, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 658db90 47/99: Simplify and-let* implementation, ELPA Syncer, 2021/10/17
- [elpa] externals/compat ad92d70 61/99: Add decoded-time-* functions from 27.1, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 476aa10 62/99: Add json-* functions from 27.1, ELPA Syncer, 2021/10/17
- [elpa] externals/compat a0ea4ae 65/99: Call alist-get-full-elisp from alist-get-handle-testfn, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 4513631 70/99: Fix compat-func-arity advice handling, ELPA Syncer, 2021/10/17