summaryrefslogtreecommitdiff
path: root/lisp/eshell/em-unix.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2001-10-17 02:00:20 +0000
committerJohn Wiegley <johnw@newartisans.com>2001-10-17 02:00:20 +0000
commit9f89e098634f1eeb0bf6e14c2b0b5f9ab575031d (patch)
tree030571ec98b7ba28431b629b89eb260f59de0ffe /lisp/eshell/em-unix.el
parentef94bd99e4c9df9002133538e68667ef73edfa66 (diff)
downloademacs-9f89e098634f1eeb0bf6e14c2b0b5f9ab575031d.tar.gz
(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.
Diffstat (limited to 'lisp/eshell/em-unix.el')
-rw-r--r--lisp/eshell/em-unix.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index c568a4286f4..2fb08d290c7 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -572,9 +572,12 @@ symlink, then revert to the system's definition of cat."
(if (or eshell-in-pipeline-p
(catch 'special
(eshell-for arg args
- (unless (let ((attrs (eshell-file-attributes arg)))
- (and attrs (memq (aref (nth 8 attrs) 0)
- '(?d ?l ?-))))
+ (unless (or (and (stringp arg)
+ (> (length arg) 0)
+ (eq (aref arg 0) ?-))
+ (let ((attrs (eshell-file-attributes arg)))
+ (and attrs (memq (aref (nth 8 attrs) 0)
+ '(?d ?l ?-)))))
(throw 'special t)))))
(let ((ext-cat (eshell-search-path "cat")))
(if ext-cat