* bug#6762: 23.2; Eshell bug in detecting read-only file (patch included)
@ 2010-07-30 10:13 Leo
2010-07-30 10:15 ` John Wiegley
0 siblings, 1 reply; 3+ messages in thread
From: Leo @ 2010-07-30 10:13 UTC (permalink / raw)
To: 6762; +Cc: John Wiegley
I have diff-default-read-only set to t and this prevents eshell from
writing to diff files i.e.
ESHELL$ git diff x..y > file.diff
fails due to its use of buffer-read-only, which doesn't necessary
reflects the read-only state of a file.
The following patch tries to fix this.
Leo
commit b1dc6a427e43470981d4700b0c98aa21ecb03052
Author: sdl.web@gmail.com
Date: Sat May 1 17:50:21 2010 +0100
Better detection of read-only file in eshell-get-target
Modified lisp/eshell/esh-io.el
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index 1bcfe2b..3aa785c 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -343,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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#6762: 23.2; Eshell bug in detecting read-only file (patch included)
2010-07-30 10:13 bug#6762: 23.2; Eshell bug in detecting read-only file (patch included) Leo
@ 2010-07-30 10:15 ` John Wiegley
2010-07-30 23:25 ` Chong Yidong
0 siblings, 1 reply; 3+ messages in thread
From: John Wiegley @ 2010-07-30 10:15 UTC (permalink / raw)
To: Leo; +Cc: bug-gnu-emacs
Looks like a great patch to me.
John
On Jul 30, 2010, at 6:13 AM, Leo wrote:
> I have diff-default-read-only set to t and this prevents eshell from
> writing to diff files i.e.
>
> ESHELL$ git diff x..y > file.diff
>
> fails due to its use of buffer-read-only, which doesn't necessary
> reflects the read-only state of a file.
>
> The following patch tries to fix this.
>
> Leo
>
> commit b1dc6a427e43470981d4700b0c98aa21ecb03052
> Author: sdl.web@gmail.com
> Date: Sat May 1 17:50:21 2010 +0100
>
> Better detection of read-only file in eshell-get-target
>
> Modified lisp/eshell/esh-io.el
> diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
> index 1bcfe2b..3aa785c 100644
> --- a/lisp/eshell/esh-io.el
> +++ b/lisp/eshell/esh-io.el
> @@ -343,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)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#6762: 23.2; Eshell bug in detecting read-only file (patch included)
2010-07-30 10:15 ` John Wiegley
@ 2010-07-30 23:25 ` Chong Yidong
0 siblings, 0 replies; 3+ messages in thread
From: Chong Yidong @ 2010-07-30 23:25 UTC (permalink / raw)
To: John Wiegley; +Cc: Leo, 6762-done
John Wiegley <jwiegley@gmail.com> writes:
> Looks like a great patch to me.
Checked in. Thanks.
> On Jul 30, 2010, at 6:13 AM, Leo wrote:
>
>> I have diff-default-read-only set to t and this prevents eshell from
>> writing to diff files i.e.
>>
>> ESHELL$ git diff x..y > file.diff
>>
>> fails due to its use of buffer-read-only, which doesn't necessary
>> reflects the read-only state of a file.
>>
>> The following patch tries to fix this.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-30 23:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-30 10:13 bug#6762: 23.2; Eshell bug in detecting read-only file (patch included) Leo
2010-07-30 10:15 ` John Wiegley
2010-07-30 23:25 ` Chong Yidong
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).