Re: [code] How to replace the "Untitled" buffer

From: Markus F.X.J. Oberhumer <markus.att.oberhumer.com>
Date: Thu, 11 Feb 2016 19:14:11 +0100

Hi Robert,

I tried that, but there seems to be some magic in lbuffer_delete() - please
see the marked line below.

Maybe adding some extra event inside lbuffer_new() or new_buffer() could help?

But then, it also seems the initial "Untitled" is created before init.lua ??

Thanks,
Markus

--- a/src/textadept.c
+++ b/src/textadept.c
@@ -1093,7 +1093,7 @@
   Scintilla *view = l_globaldoccompare(L, 1) == 0 ? focused_view : dummy_view;
   sptr_t doc = SS(view, SCI_GETDOCPOINTER, 0, 0);
   lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
- if (lua_rawlen(L, -1) == 1) new_buffer(0);
+ if (lua_rawlen(L, -1) == 1) new_buffer(0); // new Untitled buffer ???
   lL_gotodoc(L, focused_view, -1, TRUE);
   delete_buffer(doc);
   lL_event(L, "buffer_after_switch", -1), lL_event(L, "buffer_deleted", -1);

On 2016-02-11 19:03, Robert Gieseke wrote:
> Hi,
> I think you could check in a buffer closed event whether there is only an Untitled buffer left and create your Textredux buffer.
>
> Cheers,
> Robert
>
>> Am 11.02.2016 um 18:41 schrieb Markus F.X.J. Oberhumer <markus.att.oberhumer.com>:
>>
>> Hi,
>>
>> I would like to replace the "Untitled" buffer that you get when
>> there are no files or when you close all tabs, e.g. with
>> a custom textredux buffer.
>>
>> It seems this is hardcoded in textadept.c, though.
>>
>> Any hints?
>>
>> Thanks,
>> Markus
>>
>> --
>> Markus Oberhumer, <markus@oberhumer.com>, http://www.oberhumer.com/
>> --
>> 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.
>>

-- 
Markus Oberhumer, <markus@oberhumer.com>, http://www.oberhumer.com/
-- 
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 Thu 11 Feb 2016 - 13:14:11 EST

This archive was generated by hypermail 2.2.0 : Fri 12 Feb 2016 - 06:44:14 EST