Re: [textadept] Save All option

From: Robert <ro....at.web.de>
Date: Tue, 16 Aug 2011 08:58:05 +0200

On Tue, Aug 16, 2011 at 2:57 AM, mitchell <c....at.caladbolg.net> wrote:
> 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
>

You could also automatically save each time before switching to
another buffer using a buffer_before_switch event. It's a workaround,
but might give a similar result.

Robert
Received on Tue 16 Aug 2011 - 02:58:05 EDT

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