]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix evaluation of negated argument predicates in Eshell
authorJim Porter <jporterbugs@gmail.com>
Sun, 13 Mar 2022 14:36:37 +0000 (15:36 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 13 Mar 2022 19:00:35 +0000 (20:00 +0100)
* lisp/eshell/em-pred.el (eshell-add-pred-func): Let-bind 'pred' so
the lambdas see the original value (bug#54369).

Committed on the wrong branch.

Do not merge to master.

lisp/eshell/em-pred.el

index b1dc7abc696ef54b8f335b0a91ac60cb88e4c9ac..4f4e85c1a69bcafd54eefc64c179cd3d958c5ef7 100644 (file)
@@ -364,12 +364,12 @@ resultant list of strings."
 
 (defun eshell-add-pred-func (pred funcs negate follow)
   "Add the predicate function PRED to FUNCS."
-  (if negate
-      (setq pred (lambda (file)
-                  (not (funcall pred file)))))
-  (if follow
-      (setq pred (lambda (file)
-                  (funcall pred (file-truename file)))))
+  (when negate
+    (setq pred (let ((pred pred))
+                 (lambda (file) (not (funcall pred file))))))
+  (when follow
+    (setq pred (let ((pred pred))
+                 (lambda (file) (funcall pred (file-truename file))))))
   (cons pred funcs))
 
 (defun eshell-pred-user-or-group (mod-char mod-type attr-index get-id-func)