diff options
| author | Stefan Kangas | 2025-03-05 05:08:48 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2025-03-06 00:47:24 +0100 |
| commit | 4b5cc0bfc6d25ff4b7cd16c840e325e9fada4593 (patch) | |
| tree | 57cf82491cd5a9498f720657a0990cda1c6e5400 | |
| parent | af44c7630cafba832a8b7c3b302dd0b16c4f271c (diff) | |
| download | emacs-4b5cc0bfc6d25ff4b7cd16c840e325e9fada4593.tar.gz emacs-4b5cc0bfc6d25ff4b7cd16c840e325e9fada4593.zip | |
Rewrite cl--parsing-keywords using backtick
* lisp/emacs-lisp/cl-seq.el (cl--parsing-keywords): Rewrite using
backtick.
| -rw-r--r-- | lisp/emacs-lisp/cl-seq.el | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index f6be1dfd0c6..33f14df0291 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el | |||
| @@ -47,7 +47,7 @@ | |||
| 47 | ;; This is special-cased here so that we can compile | 47 | ;; This is special-cased here so that we can compile |
| 48 | ;; this file independent from cl-macs. | 48 | ;; this file independent from cl-macs. |
| 49 | 49 | ||
| 50 | (defmacro cl--parsing-keywords (kwords other-keys &rest body) | 50 | (defmacro cl--parsing-keywords (keywords other-keys &rest body) |
| 51 | (declare (indent 2) (debug (sexp sexp &rest form))) | 51 | (declare (indent 2) (debug (sexp sexp &rest form))) |
| 52 | `(let* ,(mapcar | 52 | `(let* ,(mapcar |
| 53 | (lambda (x) | 53 | (lambda (x) |
| @@ -59,26 +59,22 @@ | |||
| 59 | (setq mem `(and ,mem (setq cl-if ,mem) t))) | 59 | (setq mem `(and ,mem (setq cl-if ,mem) t))) |
| 60 | (list (intern | 60 | (list (intern |
| 61 | (format "cl-%s" (substring (symbol-name var) 1))) | 61 | (format "cl-%s" (substring (symbol-name var) 1))) |
| 62 | (if (consp x) `(or ,mem ,(car (cdr x))) mem)))) | 62 | (if (consp x) `(or ,mem ,(cadr x)) mem)))) |
| 63 | kwords) | 63 | keywords) |
| 64 | ,@(append | 64 | ,@(append |
| 65 | (and (not (eq other-keys t)) | 65 | (and (not (eq other-keys t)) |
| 66 | (list | 66 | `((let ((cl-keys-temp cl-keys)) |
| 67 | (list 'let '((cl-keys-temp cl-keys)) | 67 | (while cl-keys-temp |
| 68 | (list 'while 'cl-keys-temp | 68 | (or (memq (car cl-keys-temp) |
| 69 | (list 'or (list 'memq '(car cl-keys-temp) | 69 | (quote ,(mapcar |
| 70 | (list 'quote | 70 | (lambda (x) |
| 71 | (mapcar | 71 | (if (consp x) |
| 72 | (lambda (x) | 72 | (car x) x)) |
| 73 | (if (consp x) | 73 | (append keywords other-keys)))) |
| 74 | (car x) x)) | 74 | (cadr (memq :allow-other-keys cl-keys)) |
| 75 | (append kwords | 75 | (error "Bad keyword argument %s" |
| 76 | other-keys)))) | 76 | (car cl-keys-temp))) |
| 77 | '(car (cdr (memq (quote :allow-other-keys) | 77 | (setq cl-keys-temp (cddr cl-keys-temp)))))) |
| 78 | cl-keys))) | ||
| 79 | '(error "Bad keyword argument %s" | ||
| 80 | (car cl-keys-temp))) | ||
| 81 | '(setq cl-keys-temp (cdr (cdr cl-keys-temp))))))) | ||
| 82 | body))) | 78 | body))) |
| 83 | 79 | ||
| 84 | (defmacro cl--check-key (x) ;Expects `cl-key' in context of generated code. | 80 | (defmacro cl--check-key (x) ;Expects `cl-key' in context of generated code. |