[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-ed] Reading something into an empty file should set "changed" f
From: |
John Cowan |
Subject: |
Re: [Bug-ed] Reading something into an empty file should set "changed" flag |
Date: |
Mon, 28 Mar 2011 10:20:15 -0400 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Antonio Diaz Diaz scripsit:
> What do other users of ed think about this?
I call it a bug. POSIX is very clear:
If changes have been made in the buffer since the last w command that
wrote the entire buffer, ed shall warn the user if an attempt is made
to destroy the editor buffer via the e or q commands. The ed utility
shall write the string:
"?\n"
(followed by an explanatory message if help mode has been enabled via the
H command) to standard output and shall continue in command mode with
the current line number unchanged. If the e or q command is repeated
with no intervening command, it shall take effect.
Reading in a file certainly counts as a change in the buffer, so a
q command in that circumstance should be rejected. I suppose a
case could be made that if the read-in file is empty, the modified
flag should not be set, but I think that would be more confusing.
--
Knowledge studies others / Wisdom is self-known; John Cowan
Muscle masters brothers / Self-mastery is bone; address@hidden
Content need never borrow / Ambition wanders blind; http://ccil.org/~cowan
Vitality cleaves to the marrow / Leaving death behind. --Tao 33 (Bynner)