Re: [code] Textadept: scripting a 'close-all-tabs-but-this' contextmenu command

From: Mitchell <>
Date: Sat, 3 Nov 2018 23:14:45 -0400 (EDT)

Hi Phil,

On Sat, 3 Nov 2018, Phil S. wrote:

> Hi Mitchell,
>> Yes, unfortunately that is the way to go for now.
> thanks & no prob, doing so was trivial and a breeze in the end. Next question
> popping up right now from the trenches =) I'm trying to implement the
> editor-tab-context-menu-item "Close Others" (aka close-all-but-this-tab) that
> I've gotten quite accustomed to from most tabbed-GUIs out there (including
> numerous editors as well as browsers).
> Now, io.close_all_buffers won't help and io.close_buffer always assumes the
> current-buffer (it has no optional 'buffer_to_close' arg, so to speak), so
> I'd close in on buffer.delete but it comes with a FAT warning: "Do not call
> this function". Begging the question: what's the worst that could happen?

I think the worst that could happen is data loss for unsaved changes.

I would iterate through buffers, call `view:goto_buffer()` for each buffer you want to close, then call `buffer:close()`. In the end, you'll wind up with only one buffer -- the one you want to keep.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sat 03 Nov 2018 - 23:14:45 EDT

This archive was generated by hypermail 2.2.0 : Sun 04 Nov 2018 - 06:42:17 EST