Re: [code] [textadept] optimize io.save_all_files a little bit

From: Rena <hyperhacker.att.gmail.com>
Date: Thu, 10 Dec 2015 11:10:47 -0500

On Dec 10, 2015 10:30 AM, "Mitchell" <m.att.foicica.com> wrote:
>
> Hi Ivan,
>
>
> On Wed, 9 Dec 2015, basiliscos wrote:
>
>> Hello
>>
>> Please, apply the following patch: no need to visit buffer, unless it
>> is going to save it.
>>
>> I work with mounted remote FS, so the save-all is rather slow, becasue
>> on every buffer switch it tries to update it (check modifications). When
>> there are many opened files this becomes annoying. The patch solves it.
>>
>>
>> diff -ru /tmp/textadept_8.4.x86_64/core/file_io.lua
textadept_8.4.x86_64/core/file_io.lua
>> --- /tmp/textadept_8.4.x86_64/core/file_io.lua 2015-11-11
17:09:33.000000000 +0300
>> +++ textadept_8.4.x86_64/core/file_io.lua 2015-12-09
15:09:14.120752349 +0300
>> @@ -245,8 +245,10 @@
>> function io.save_all_files()
>> local current_buffer = _BUFFERS[buffer]
>> for i, buffer in ipairs(_BUFFERS) do
>> - view:goto_buffer(i)
>> - if buffer.filename and buffer.modify then io.save_file() end
>> + if buffer.filename and buffer.modify then
>> + view:goto_buffer(i)
>> + io.save_file()
>> + end
>> end
>> view:goto_buffer(current_buffer)
>> end
>
>
> Thanks for your contribution! Committed[1] and will be in the next
nightly.
>
> Cheers,
> Mitchell
>
> [1]: http://foicica.com/hg/textadept/rev/90bd6d2e85b3
> --
> You are subscribed to code.att.foicica.com.
> To change subscription settings, send an e-mail to code+help.att.foicica.com.
> To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
>

I don't understand why it has to make the buffer visible to save it?

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 10 Dec 2015 - 11:10:47 EST

This archive was generated by hypermail 2.2.0 : Fri 11 Dec 2015 - 06:50:43 EST