]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/mpc.el (mpc-intersection): Fix commit 1760029b0927242
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 3 Jun 2021 22:05:01 +0000 (18:05 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 5 Jun 2021 15:56:01 +0000 (11:56 -0400)
lisp/mpc.el

index 9addb70f56af43a19e70187153e5a2232026290b..ab572aa539a58feee8c33c4ca69f12b6ef37c9ba 100644 (file)
           (unless (member elem seen) (push elem res)))))
     (nreverse res)))
 
-(defun mpc-intersection (l1 l2 &optional selectfun)
+(defun mpc-intersection (l1 l2 selectfun)
   "Return L1 after removing all elements not found in L2.
-If SELECTFUN is non-nil, elements aren't compared directly, but instead
+Elements aren't compared directly, but instead
 they are passed through SELECTFUN before comparison."
-  (when selectfun
-    (setq l1 (mapcar selectfun l1))
-    (setq l2 (mapcar selectfun l2)))
-  (seq-intersection l1 l2))
+  (seq-intersection l1 l2 (lambda (x y)
+                            (equal (funcall selectfun x)
+                                   (funcall selectfun y)))))
 
 (defun mpc-event-set-point (event)
   (condition-case nil (posn-set-point (event-end event))