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

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

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.
Received on Thu 10 Dec 2015 - 10:30:06 EST

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