Re: Question about File > Open and the "Untitled" buffer

From: Robert <ro....at.web.de>
Date: Fri, 9 Apr 2010 06:25:58 -0700 (PDT)

On 9 Apr., 13:57, morchel <morc....at.hotmail.com> wrote:
> http://groups.google.com/group/textadept/browse_thread/thread/8ee7922...

A while ago I tried to find a solution for this by closing the
Untitled buffer in sessions.lua. I wasn't happy with my solution (as
there were problems with the wrong view (not the buffer) being
focussed when split views where saved.) Russels request made me think
about trying it within textadept.io, which should be better.

This is around line 172 in core/file_io.lua
...
textadept.events.handle('file_opened', utf8_filename)
if (#textadept.buffers == 2 ) and not textadept.buffers[1].filename
and not textadept.buffers[1].dirty then
  view:goto_buffer(1, true)
  textadept.buffers[1]:close()
end
for index, file in ipairs(recent_files) do
...
(Sorry no diff tool installed here...)
By checking for the number of open buffers this will not close an
Untitled buffer if it was created by you later.
Could those who are interested maybe try this out, possibly come up
with a more elegant solution and check for other side effects :-). It
should solve both the problem with the open file dialog as well as the
session loading.
Is there a way to close a buffer in the background, to avoid actually
switching to it? If I skip the line view:goto... I get an error.

Robert
Received on Fri 09 Apr 2010 - 09:25:58 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:42:53 EST