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

From: basiliscos <basiliscos.att.openmailbox.org>
Date: Wed, 9 Dec 2015 17:07:16 +0300

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

-- 
Best regards,
Bασιλίσκος Arcticus ὑπέρnihilisticus 
(aka Ivan Baidakou) <basiliscos.att.openmailbox.org>

-- 
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 Wed 09 Dec 2015 - 09:07:16 EST

This archive was generated by hypermail 2.2.0 : Thu 10 Dec 2015 - 06:41:53 EST