bug-ed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warn when editing read-only files


From: John Cowan
Subject: Re: Warn when editing read-only files
Date: Fri, 17 Nov 2023 08:19:47 -0500

On Fri, Nov 17, 2023 at 7:59 AM Antonio Diaz Diaz <antonio@gnu.org> wrote:

So this should be
> doable in GNU ed as soon as we find a way to reset the 'read_only' flag.
> Maybe by changing the name of the file with 'f'?


In vi, 'f' does not reset the readonly flag, since its meaning is that the
buffer should not be writable.  The only way to do so (other than editing
some other file) is to use the command `set noreadonly`.  The readonly flag
can be set by editing a read-only file, by using the command `set
readonly`, or by using the -R command-line option.  When the readonly flag
is set, a warning is printed on the first change to the buffer, and an
error is printed on any attempt to write the file.

Since ed does not have a 'set' command, to emulate this interface it would
be necessary to add two commands (or one command with a special argument).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]