From 8e7a3f21e00649bacc01be627edd45ff01b51a33 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sun, 13 Mar 2022 15:36:37 +0100 Subject: [PATCH] Fix evaluation of negated argument predicates in Eshell * 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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index b1dc7abc696..4f4e85c1a69 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el @@ -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) -- 2.39.5