summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-macs.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2000-10-15 05:23:57 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2000-10-15 05:23:57 +0000
commita2d379fb258f190be346977328dc231bbb2a49f5 (patch)
tree6fbc0ad31c81719f9284c74712856b87c0c464ed /lisp/emacs-lisp/cl-macs.el
parent3c7fafc7b5a363803221896a1bb32c6df9c170dd (diff)
downloademacs-a2d379fb258f190be346977328dc231bbb2a49f5.tar.gz
(cl-do-arglist): Use plist-get and plist-member instead of memq.
Diffstat (limited to 'lisp/emacs-lisp/cl-macs.el')
-rw-r--r--lisp/emacs-lisp/cl-macs.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 3dd84648945..a57a3821564 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -257,13 +257,17 @@ ARGLIST allows full Common Lisp conventions."
(while (and (eq (car args) '&key) (cl-pop args))
(while (and args (not (memq (car args) lambda-list-keywords)))
(let ((arg (cl-pop args)))
- (or (consp arg) (setq arg (list arg)))
+ (if (not (consp arg))
+ ;; Simple key arg, we can use plist-get.
+ (let ((karg (intern (format ":%s" arg))))
+ (cl-do-arglist arg `(plist-get ,restarg ,karg))
+ (cl-push karg keys))
(let* ((karg (if (consp (car arg)) (caar arg)
(intern (format ":%s" (car arg)))))
(varg (if (consp (car arg)) (cadar arg) (car arg)))
(def (if (cdr arg) (cadr arg)
(or (car bind-defs) (cadr (assq varg bind-defs)))))
- (look (list 'memq (list 'quote karg) restarg)))
+ (look (list 'plist-member restarg (list 'quote karg))))
(and def bind-enquote (setq def (list 'quote def)))
(if (cddr arg)
(let* ((temp (or (nth 2 arg) (gensym)))
@@ -285,7 +289,7 @@ ARGLIST allows full Common Lisp conventions."
'quote
(list nil (cl-const-expr-val def)))
(list 'list nil def))))))))
- (cl-push karg keys)))))
+ (cl-push karg keys))))))
(setq keys (nreverse keys))
(or (and (eq (car args) '&allow-other-keys) (cl-pop args))
(null keys) (= safety 0)
@@ -298,10 +302,7 @@ ARGLIST allows full Common Lisp conventions."
(list (list 'memq (list 'car var)
(list 'quote (append keys allow)))
(list 'setq var (list 'cdr (list 'cdr var))))
- (list (list 'car
- (list 'cdr
- (list 'memq (cons 'quote allow)
- restarg)))
+ (list (list 'plist-get restarg (car allow))
(list 'setq var nil))
(list t
(list