[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] Fwd: Re: [PATCH] allow suppressing the creation of .save fi
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] Fwd: Re: [PATCH] allow suppressing the creation of .save files |
Date: |
Wed, 21 Jun 2017 11:20:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 |
[Some trouble sending mail... Trying again.]
Op 20-06-17 om 22:29 schreef Rishabh Dave:
I have attached a patch implementing the request of disabling
creation of ".save" files that was posted on the bug tracker (see
https://savannah.gnu.org/bugs/?30749). With some code and testing,
the patch fulfils the request.
Nice.
There are some questions, though, regarding implementation of this
option. What character is suitable for the short option?
The Z is fine. The mnemonic value would be that a dot-save file is
the very last thing (end of alphabet) that nano would do before it dies.
Can we have a long option without having short option in nano?
We could.
Will it be better to only have long option?
Don't know. Probably not.
I haven't looked into how should it be implemented to set
NO_SAVEFILE from the rcfile. But the rcile must have "set
nosavefile", right?
Of course.
And any idea where should be NO_SAVEFILE be initialized to a default
value (which will be unset) ?
The array of flags is initialized to all zeros in global.c, line 99:
unsigned flags[4] = {0, 0, 0, 0};
So there is no need to unset any flag specifically.
However, the NO_SAVEFILE and --nosavefile are not good names, because
there already is a bindable function with the name 'savefile'. So a
better name for the flag and option are NO_DOTSAVE and --nodotsave.
A second however: it is a request in the bug tracker, but it is very
low priority: there is only one person who asked for this, and for a
reason that wasn't really valid, plus he wanted the flag to default
to on, which is something we cannot do/change now. So... you can
make the patch, but I won't apply it until there is some definite
demand for it.
Unlike before, syntax colouring is on, so I hope no whitespace has
crept into the patch.
The line where you unset the flag should have been indented, but it
can be removed, and in the rest there are no problems.
Oh! The place where you do:
+ if (ISSET(NO_SAVEFILE))
+ return;
is wrong. You should certainly restore the state of the terminal,
print the error message, and remove any lock file. Only then can
insert the above fragment. And you shouldn't return, you should do
exit(1). But that isn't good enough either, because there may be
multiple files open, each with a lock file, so all lock files should
be deleted first. So instead of in die(), you should add the above
fragment to die_save_file() -- with a return, not an exit.
Benno
- [Nano-devel] Fwd: Re: [PATCH] allow suppressing the creation of .save files,
Benno Schulenberg <=