[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] snipping almost twenty lines out of the commenting code
From: |
Mike Scalora |
Subject: |
Re: [Nano-devel] snipping almost twenty lines out of the commenting code |
Date: |
Fri, 3 Jun 2016 06:06:51 -0600 |
On Fri, Jun 3, 2016 at 3:22 AM, Benno Schulenberg
<address@hidden> wrote:
>...
> Thinking about it, a better way to prevent the unwanted undo item
> presented itself. It even gets rid of the file_changed bool. See the
> first patch again.
That's better.
>> I'm not a fan of using a global to eliminate a function but given how
>> much you value fewer lines and the historical use of globals in the
>> codebase I guess it's the thing to do.
>
> I don't like globals either. We could pass it to add_undo(), but that
> would mean that twenty other calls would have to pass NULL -- that's a
> waste too. I tried a different way in the second patch, but that doesn't
> make things cleaner either.
I like that better. I'm neck deep in indent code right now, just last
night I was thinking that tabsize should be a per-file variable.
> And... only now it occurs to me to just set
> openfile->current_undo->strdata right after the add_undo in do_comment.
> Pfff, easy. No need for any global. Just a little tweaking of the undo
> item after creating it because it's too much work to pass the data.
Would it be heresy to suggest a variadic function?
> Benno