Function: eshell-pred-user-or-group

eshell-pred-user-or-group is a byte-compiled function defined in em-pred.el.gz.

Signature

(eshell-pred-user-or-group MOD-CHAR MOD-TYPE ATTR-INDEX GET-ID-FUNC)

Documentation

Return a predicate to test whether a file match a given user/group id.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-pred.el.gz
(defun eshell-pred-user-or-group (mod-char mod-type attr-index get-id-func)
  "Return a predicate to test whether a file match a given user/group id."
  (let ((ugid (eshell-get-numeric-modifier-argument)))
    (unless ugid
      (let ((ugname (or (eshell-get-delimited-modifier-argument)
                        (error "Malformed %s name string for modifier `%c'"
                               mod-type mod-char))))
        (setq ugid (funcall get-id-func ugname))))
    (unless ugid
      (error "Unknown %s name specified for modifier `%c'"
	     mod-type mod-char))
    (lambda (file)
      (when-let* ((attrs (file-attributes file)))
	(= (nth attr-index attrs) ugid)))))