Function: eshell-winnow-list

eshell-winnow-list is a byte-compiled function defined in esh-util.el.gz.

Signature

(eshell-winnow-list ENTRIES EXCLUDE &optional PREDICATES)

Documentation

Pare down the ENTRIES list using the EXCLUDE regexp, and PREDICATES.

The original list is not affected. If the result is only one element long, it will be returned itself, rather than returning a one-element list.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-util.el.gz
(defun eshell-winnow-list (entries exclude &optional predicates)
  "Pare down the ENTRIES list using the EXCLUDE regexp, and PREDICATES.
The original list is not affected.  If the result is only one element
long, it will be returned itself, rather than returning a one-element
list."
  (let ((flist (list t))
	valid p listified)
    (unless (listp entries)
      (setq entries (list entries)
	    listified t))
    (dolist (entry entries)
      (unless (and exclude (string-match exclude entry))
	(setq p predicates valid (null p))
	(while p
	  (if (funcall (car p) entry)
	      (setq valid t)
	    (setq p nil valid nil))
	  (setq p (cdr p)))
	(when valid
	  (nconc flist (list entry)))))
    (if listified
	(cadr flist)
      (cdr flist))))