changeset 109697:672b957881a8

* lisp/eshell/esh-io.el (eshell-get-target): Better detection of read-only file (Bug#6762).
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 30 Jul 2010 19:25:06 -0400
parents 637b204b4c71
children e3caf0b09548
files lisp/ChangeLog lisp/eshell/esh-io.el
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Jul 30 02:54:53 2010 +0200
+++ b/lisp/ChangeLog	Fri Jul 30 19:25:06 2010 -0400
@@ -1,3 +1,8 @@
+2010-07-30  Leo  <sdl.web@gmail.com>
+
+	* eshell/esh-io.el (eshell-get-target): Better detection of
+	read-only file (Bug#6762).
+
 2010-07-30  Juanma Barranquero  <lekktu@gmail.com>
 
 	* align.el (align-default-spacing): Doc fix.
--- a/lisp/eshell/esh-io.el	Fri Jul 30 02:54:53 2010 +0200
+++ b/lisp/eshell/esh-io.el	Fri Jul 30 19:25:06 2010 -0400
@@ -343,8 +343,9 @@
 	(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)