summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Porter <jporterbugs@gmail.com>2022-03-13 15:36:37 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-03-13 19:59:07 +0100
commitea3c147d2dcb65840ad5ec5c4d8786d36a5ea0dc (patch)
treec51e76a34cc69064d8cca3a641055c89831c8270
parentedb8481ce15404d9157e104958aef22b05b606a7 (diff)
downloademacs-ea3c147d2dcb65840ad5ec5c4d8786d36a5ea0dc.tar.gz
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).
-rw-r--r--lisp/eshell/em-pred.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 216c71f59e4..970329e12a9 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -360,12 +360,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)