nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] allow suppressing the creation of .save files


From: Rishabh Dave
Subject: Re: [Nano-devel] [PATCH] allow suppressing the creation of .save files
Date: Thu, 22 Jun 2017 00:52:47 +0530

On Wed, Jun 21, 2017 at 1:37 PM, Benno Schulenberg <address@hidden> wrote:
>> 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.

Okay. I was facing some trouble with it. Even when 'Z' wasn't passed
as an argument, nano died without creating ".save" file. So, for that
moment I wrote _that_ unindented line.

> 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.

Okay.

> 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.

I am writing it only because its title tells that ".save" file can be
suppressed, which can be handy sometimes (and also the only possible
way to do that).

>> 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.

It was quick fix to obtain the desired behaviour, so I left it
unindented purposefully.

> 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.

Yes, the patch is unfinished. I suppose this was also the reason for
all the copies of nano that were stuck in the computer's memory during
testing the patch.

By the do you remember all the code? Because you are making some very
specific suggestions.  :)



reply via email to

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