aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Wiegley2004-05-15 22:45:35 +0000
committerJohn Wiegley2004-05-15 22:45:35 +0000
commite1703ba9ac483b4d19d80ecc142d1e88eb39ba82 (patch)
tree53073dfc98f158a357630d5ed9dfb1dbf74fc4ae
parente9e132edf5d355c2316038d4d08c20e6f7850d53 (diff)
downloademacs-e1703ba9ac483b4d19d80ecc142d1e88eb39ba82.tar.gz
emacs-e1703ba9ac483b4d19d80ecc142d1e88eb39ba82.zip
2004-05-15 John Wiegley <johnw@newartisans.com>
* eshell/esh-io.el (eshell-get-target): whitespace changes. (eshell-output-object-to-target): Improve output speed 20% by not calling `eshell-stringify' if something is already known to be a string.
-rw-r--r--lisp/eshell/esh-io.el46
1 files changed, 26 insertions, 20 deletions
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index 8d1036b736e..d832fa9cd03 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -333,22 +333,23 @@ it defaults to `insert'."
333 (cond 333 (cond
334 ((stringp target) 334 ((stringp target)
335 (let ((redir (assoc target eshell-virtual-targets))) 335 (let ((redir (assoc target eshell-virtual-targets)))
336 (if redir 336 (if redir
337 (if (nth 2 redir) 337 (if (nth 2 redir)
338 (funcall (nth 1 redir) mode) 338 (funcall (nth 1 redir) mode)
339 (nth 1 redir)) 339 (nth 1 redir))
340 (let* ((exists (get-file-buffer target)) 340 (let* ((exists (get-file-buffer target))
341 (buf (find-file-noselect target t))) 341 (buf (find-file-noselect target t)))
342 (with-current-buffer buf 342 (with-current-buffer buf
343 (if buffer-read-only 343 (if buffer-read-only
344 (error "Cannot write to read-only file `%s'" target)) 344 (error "Cannot write to read-only file `%s'" target))
345 (set (make-local-variable 'eshell-output-file-buffer) 345 (set (make-local-variable 'eshell-output-file-buffer)
346 (if (eq exists buf) 0 t)) 346 (if (eq exists buf) 0 t))
347 (cond ((eq mode 'overwrite) 347 (cond ((eq mode 'overwrite)
348 (erase-buffer)) 348 (erase-buffer))
349 ((eq mode 'append) 349 ((eq mode 'append)
350 (goto-char (point-max)))) 350 (goto-char (point-max))))
351 (point-marker)))))) 351 (point-marker))))))
352
352 ((or (bufferp target) 353 ((or (bufferp target)
353 (and (boundp 'eshell-buffer-shorthand) 354 (and (boundp 'eshell-buffer-shorthand)
354 (symbol-value 'eshell-buffer-shorthand) 355 (symbol-value 'eshell-buffer-shorthand)
@@ -363,15 +364,18 @@ it defaults to `insert'."
363 ((eq mode 'append) 364 ((eq mode 'append)
364 (goto-char (point-max)))) 365 (goto-char (point-max))))
365 (point-marker)))) 366 (point-marker))))
366 ((functionp target) 367
367 nil) 368 ((functionp target) nil)
369
368 ((symbolp target) 370 ((symbolp target)
369 (if (eq mode 'overwrite) 371 (if (eq mode 'overwrite)
370 (set target nil)) 372 (set target nil))
371 target) 373 target)
374
372 ((or (eshell-processp target) 375 ((or (eshell-processp target)
373 (markerp target)) 376 (markerp target))
374 target) 377 target)
378
375 (t 379 (t
376 (error "Illegal redirection target: %s" 380 (error "Illegal redirection target: %s"
377 (eshell-stringify target))))) 381 (eshell-stringify target)))))
@@ -481,7 +485,8 @@ Returns what was actually sent, or nil if nothing was sent."
481 (let ((moving (= (point) target))) 485 (let ((moving (= (point) target)))
482 (save-excursion 486 (save-excursion
483 (goto-char target) 487 (goto-char target)
484 (setq object (eshell-stringify object)) 488 (unless (stringp object)
489 (setq object (eshell-stringify object)))
485 (insert-and-inherit object) 490 (insert-and-inherit object)
486 (set-marker target (point-marker))) 491 (set-marker target (point-marker)))
487 (if moving 492 (if moving
@@ -489,7 +494,8 @@ Returns what was actually sent, or nil if nothing was sent."
489 494
490 ((eshell-processp target) 495 ((eshell-processp target)
491 (when (eq (process-status target) 'run) 496 (when (eq (process-status target) 'run)
492 (setq object (eshell-stringify object)) 497 (unless (stringp object)
498 (setq object (eshell-stringify object)))
493 (process-send-string target object))) 499 (process-send-string target object)))
494 500
495 ((consp target) 501 ((consp target)