Re: [textadept] Save All option

From: mitchell <c....at.caladbolg.net>
Date: Mon, 15 Aug 2011 20:57:28 -0400 (EDT)

Hi Patrick,

On Mon, 15 Aug 2011, Patrick wrote:

> Is there an option somewhere to save all buffers opened for edit that currently have unsaved changes? �I see a "Close All" option,
> it would be nice to also have a similar "Save All" option if there isn't one already. �I find myself wanting to do that fairly
> regularly.

The basic code would look something like this:

for i, _ in ipairs(_BUFFERS) do
   view:goto_buffer(i, true)
   buffer:save()
end

However, that cycles through all buffers (which looks quite odd and
disorienting) and ends up with the last opened buffer in the current view.
In order to restore the buffer that was previously there, a whole other
loop (similar to the one in gui._print) has to be run first to determine
the current buffer index, and then another 'view:goto_buffer(...)' line of
code to do the restoration. I don't like either of these behaviors and
that is why save_all() was never implemented.

mitchell
Received on Mon 15 Aug 2011 - 20:57:28 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:19:23 EST