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

From: Mitchell <m.att.foicica.com>
Date: Sat, 12 Dec 2015 00:10:30 -0500 (EST)

Hi,

On Thu, 10 Dec 2015, Rena wrote:

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

This is likely a relic from the past. Prior to Textadept 7.0, buffers
needed to be visible in order to retrieve their text (and manipulate
them). I will look into seeing if this can be removed. Thanks for bringing
it to my attention.

Cheers,
Mitchell

-- 
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 Sat 12 Dec 2015 - 00:10:30 EST

This archive was generated by hypermail 2.2.0 : Sat 12 Dec 2015 - 06:30:05 EST