# HG changeset patch # User Chong Yidong # Date 1280532306 14400 # Node ID 672b957881a86670b09a606c8bfff8423ba3654f # Parent 637b204b4c71c393c31882df69c8540247b75377 * lisp/eshell/esh-io.el (eshell-get-target): Better detection of read-only file (Bug#6762). diff -r 637b204b4c71 -r 672b957881a8 lisp/ChangeLog --- 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 + + * eshell/esh-io.el (eshell-get-target): Better detection of + read-only file (Bug#6762). + 2010-07-30 Juanma Barranquero * align.el (align-default-spacing): Doc fix. diff -r 637b204b4c71 -r 672b957881a8 lisp/eshell/esh-io.el --- 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)