Mercurial > emacs
comparison lisp/eshell/esh-io.el @ 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 | 1d1d5d9bd884 |
children | f57f72bb4757 376148b31b5e |
comparison
equal
deleted
inserted
replaced
109696:637b204b4c71 | 109697:672b957881a8 |
---|---|
341 (funcall (nth 1 redir) mode) | 341 (funcall (nth 1 redir) mode) |
342 (nth 1 redir)) | 342 (nth 1 redir)) |
343 (let* ((exists (get-file-buffer target)) | 343 (let* ((exists (get-file-buffer target)) |
344 (buf (find-file-noselect target t))) | 344 (buf (find-file-noselect target t))) |
345 (with-current-buffer buf | 345 (with-current-buffer buf |
346 (if buffer-read-only | 346 (if buffer-file-read-only |
347 (error "Cannot write to read-only file `%s'" target)) | 347 (error "Cannot write to read-only file `%s'" target)) |
348 (setq buffer-read-only nil) | |
348 (set (make-local-variable 'eshell-output-file-buffer) | 349 (set (make-local-variable 'eshell-output-file-buffer) |
349 (if (eq exists buf) 0 t)) | 350 (if (eq exists buf) 0 t)) |
350 (cond ((eq mode 'overwrite) | 351 (cond ((eq mode 'overwrite) |
351 (erase-buffer)) | 352 (erase-buffer)) |
352 ((eq mode 'append) | 353 ((eq mode 'append) |