Add 2012 to FSF copyright years for Emacs files
[bpt/emacs.git] / lisp / eshell / esh-io.el
index dea723e..c8230e0 100644 (file)
@@ -1,16 +1,15 @@
 ;;; esh-io.el --- I/O management
 
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2012  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,9 +17,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 ;;   (+ 1 2) > a > b > c   ; prints number to all three files
 ;;   (+ 1 2) > a | wc      ; prints to 'a', and pipes to 'wc'
 
+;;; Code:
+
 (provide 'esh-io)
 
-(eval-when-compile (require 'eshell))
+(eval-when-compile
+  (require 'cl)
+  (require 'eshell))
 
 (defgroup eshell-io nil
   "Eshell's I/O management code provides a scheme for treating many
@@ -70,13 +71,14 @@ though they were files."
 
 ;;; User Variables:
 
-(defcustom eshell-io-load-hook '(eshell-io-initialize)
-  "*A hook that gets run when `eshell-io' is loaded."
+(defcustom eshell-io-load-hook nil
+  "A hook that gets run when `eshell-io' is loaded."
+  :version "24.1"                      ; removed eshell-io-initialize
   :type 'hook
   :group 'eshell-io)
 
 (defcustom eshell-number-of-handles 3
-  "*The number of file handles that eshell supports.
+  "The number of file handles that eshell supports.
 Currently this is standard input, output and error.  But even all of
 these Emacs does not currently support with asynchronous processes
 \(which is what eshell uses so that you can continue doing work in
@@ -85,17 +87,17 @@ other buffers) ."
   :group 'eshell-io)
 
 (defcustom eshell-output-handle 1
-  "*The index of the standard output handle."
+  "The index of the standard output handle."
   :type 'integer
   :group 'eshell-io)
 
 (defcustom eshell-error-handle 2
-  "*The index of the standard error handle."
+  "The index of the standard error handle."
   :type 'integer
   :group 'eshell-io)
 
 (defcustom eshell-buffer-shorthand nil
-  "*If non-nil, a symbol name can be used for a buffer in redirection.
+  "If non-nil, a symbol name can be used for a buffer in redirection.
 If nil, redirecting to a buffer requires buffer name syntax.  If this
 variable is set, redirection directly to Lisp symbols will be
 impossible.
@@ -108,7 +110,7 @@ Example:
   :group 'eshell-io)
 
 (defcustom eshell-print-queue-size 5
-  "*The size of the print queue, for doing buffered printing.
+  "The size of the print queue, for doing buffered printing.
 This is basically a speed enhancement, to avoid blocking the Lisp code
 from executing while Emacs is redisplaying."
   :type 'integer
@@ -125,7 +127,7 @@ from executing while Emacs is redisplaying."
                       (let ((x-select-enable-clipboard t))
                         (kill-new "")))
                   'eshell-clipboard-append) t))
-  "*Map virtual devices name to Emacs Lisp functions.
+  "Map virtual devices name to Emacs Lisp functions.
 If the user specifies any of the filenames above as a redirection
 target, the function in the second element will be called.
 
@@ -341,8 +343,9 @@ it defaults to `insert'."
        (let* ((exists (get-file-buffer target))
               (buf (find-file-noselect target t)))
          (with-current-buffer buf
-           (if buffer-read-only
+           (if buffer-file-read-only
                (error "Cannot write to read-only file `%s'" target))
+           (setq buffer-read-only nil)
            (set (make-local-variable 'eshell-output-file-buffer)
                 (if (eq exists buf) 0 t))
            (cond ((eq mode 'overwrite)
@@ -382,8 +385,7 @@ it defaults to `insert'."
     (error "Invalid redirection target: %s"
           (eshell-stringify target)))))
 
-(eval-when-compile
-  (defvar grep-null-device))
+(defvar grep-null-device)
 
 (defun eshell-set-output-handle (index mode &optional target)
   "Set handle INDEX, using MODE, to point to TARGET."
@@ -514,7 +516,4 @@ Returns what was actually sent, or nil if nothing was sent."
        (eshell-output-object-to-target object (car target))
        (setq target (cdr target))))))
 
-;;; Code:
-
-;; arch-tag: 9ca2080f-d5e0-4b26-aa0b-d59194a905a2
 ;;; esh-io.el ends here