]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/esh-io.el
Update copyright year to 2015
[gnu-emacs] / lisp / eshell / esh-io.el
index 4edb47e4758cfa2a078a3a70264d421fe6e030fc..7dfc39f3202ff1a71bedc4424027cccb1c5fde5b 100644 (file)
@@ -1,6 +1,6 @@
-;;; esh-io.el --- I/O management
+;;; esh-io.el --- I/O management  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2015 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -126,7 +126,7 @@ from executing while Emacs is redisplaying."
                   'eshell-kill-append) t)
     ("/dev/clip" (lambda (mode)
                   (if (eq mode 'overwrite)
-                      (let ((x-select-enable-clipboard t))
+                      (let ((gui-select-enable-clipboard t))
                         (kill-new "")))
                   'eshell-clipboard-append) t))
   "Map virtual devices name to Emacs Lisp functions.
@@ -179,8 +179,8 @@ not be added to this variable."
   (make-local-variable 'eshell-current-redirections)
   (add-hook 'eshell-pre-rewrite-command-hook
            'eshell-strip-redirections nil t)
-  (add-hook 'eshell-post-rewrite-command-hook
-           'eshell-apply-redirections nil t))
+  (add-function :filter-return (local 'eshell-post-rewrite-command-function)
+                #'eshell--apply-redirections))
 
 (defun eshell-parse-redirection ()
   "Parse an output redirection, such as '2>'."
@@ -223,28 +223,27 @@ not be added to this variable."
     (setq eshell-current-redirections
          (cdr eshell-current-redirections))))
 
-(defun eshell-apply-redirections (cmdsym)
+(defun eshell--apply-redirections (cmd)
   "Apply any redirection which were specified for COMMAND."
   (if eshell-current-redirections
-      (set cmdsym
-          (append (list 'progn)
-                  eshell-current-redirections
-                  (list (symbol-value cmdsym))))))
+      `(progn
+         ,@eshell-current-redirections
+         ,cmd)
+    cmd))
 
 (defun eshell-create-handles
-  (standard-output output-mode &optional standard-error error-mode)
+  (stdout output-mode &optional stderr error-mode)
   "Create a new set of file handles for a command.
 The default location for standard output and standard error will go to
-STANDARD-OUTPUT and STANDARD-ERROR, respectively.
+STDOUT and STDERR, respectively.
 OUTPUT-MODE and ERROR-MODE are either `overwrite', `append' or `insert';
 a nil value of mode defaults to `insert'."
   (let ((handles (make-vector eshell-number-of-handles nil))
-       (output-target (eshell-get-target standard-output output-mode))
-       (error-target (eshell-get-target standard-error error-mode)))
+       (output-target (eshell-get-target stdout output-mode))
+        (error-target (eshell-get-target stderr error-mode)))
     (aset handles eshell-output-handle (cons output-target 1))
-    (if standard-error
-       (aset handles eshell-error-handle (cons error-target 1))
-      (aset handles eshell-error-handle (cons output-target 1)))
+    (aset handles eshell-error-handle
+          (cons (if stderr error-target output-target) 1))
     handles))
 
 (defun eshell-protect-handles (handles)
@@ -327,7 +326,7 @@ last execution result should not be changed."
 (defun eshell-clipboard-append (string)
   "Call `kill-append' with STRING, if it is indeed a string."
   (if (stringp string)
-      (let ((x-select-enable-clipboard t))
+      (let ((gui-select-enable-clipboard t))
        (kill-append string nil))))
 
 (defun eshell-get-target (target &optional mode)