comparison lisp/eshell/em-unix.el @ 39985:3a906538d254

(eshell/cat): Do a quick test if something is a regular file, before checking if it is a directory or symlink. This avoids a call to eshell-file-attributes, which can be expensive in some situations.
author John Wiegley <johnw@newartisans.com>
date Wed, 17 Oct 2001 02:00:20 +0000
parents 1e91a5f60ae6
children fcff0a75131f
comparison
equal deleted inserted replaced
39984:5e4848f89017 39985:3a906538d254
570 symlink, then revert to the system's definition of cat." 570 symlink, then revert to the system's definition of cat."
571 (setq args (eshell-stringify-list (eshell-flatten-list args))) 571 (setq args (eshell-stringify-list (eshell-flatten-list args)))
572 (if (or eshell-in-pipeline-p 572 (if (or eshell-in-pipeline-p
573 (catch 'special 573 (catch 'special
574 (eshell-for arg args 574 (eshell-for arg args
575 (unless (let ((attrs (eshell-file-attributes arg))) 575 (unless (or (and (stringp arg)
576 (and attrs (memq (aref (nth 8 attrs) 0) 576 (> (length arg) 0)
577 '(?d ?l ?-)))) 577 (eq (aref arg 0) ?-))
578 (let ((attrs (eshell-file-attributes arg)))
579 (and attrs (memq (aref (nth 8 attrs) 0)
580 '(?d ?l ?-)))))
578 (throw 'special t))))) 581 (throw 'special t)))))
579 (let ((ext-cat (eshell-search-path "cat"))) 582 (let ((ext-cat (eshell-search-path "cat")))
580 (if ext-cat 583 (if ext-cat
581 (throw 'eshell-replace-command 584 (throw 'eshell-replace-command
582 (eshell-parse-command ext-cat args)) 585 (eshell-parse-command ext-cat args))