Re: [code] Creating new buffers during Textadept's init.lua execution results in severe errors.

From: David Tamar <david-tamar.att.outlook.com>
Date: Mon, 29 Jul 2019 18:13:29 +0000

Hi, Mitchell.
I tried to test this with the event right now, the result is very similar to case #1 in my previous mail:
The file is opened and shown, but the lexer fails to show the colors on first look, but switching between tabs brings the colors back.
Here's the sample from my "init.lua":
local function test()
     io.open_file("/home/david/.textadept/init.lua")
end
events.connect(events.INITIALIZED, test)
But I'm not sure if it'd allow me to reach my goals. I'm trying to develop an advanced Lua tracer for Textadept itself right now, so I need to create buffers when the errors/assertions occur. I needed to open files (or preferably empty new buffers) imperatively.

These files include Lua functions that have participated in the stack trace, and I need to show the user exactly what was going on in the stack trace with all available debug data displayed inside the buffer itself next to the associated variables/function names etc.

I really need to create buffers because Scintilla could allow me to make the variables/function names clickable and enable interactive mode for the user to explore all the data. I just can't ensure stability with buffer creation to proceed with it, and since the Tracer kicks in it's already an "unstable" situation.

So far I developed a prototype tracer that uses ui.dialogs.textbox, and another one with ui.dialogs.filteredlist for the stack trace with nice columns, tables, local data and all that. But the main problem with dialogs.textbox for me is the use of GTK's text-box instead of Scintilla, so no lexers or clickable text for a more interactive Tracer.
________________________________
From: Mitchell <m.att.foicica.com>
Sent: Monday, July 29, 2019 20:48
To: code.att.foicica.com <code.att.foicica.com>
Subject: Re: [code] Creating new buffers during Textadept's init.lua execution results in severe errors.

Hi David,

On Mon, 29 Jul 2019, David Tamar wrote:

> Hi, I think I've found another closely-related bug that has to do with buffers.
> In this one I'm trying to open a file imperatively from a Lua module in Textadept like this:
> io.open_file("/foo/bar.lua")
> Sometimes it works properly, but most of the time it works and then breaks Textadept's lexer and other components. Here's a detailed report:
> [snip]

In general, one should not try to open files or create buffers during Textadept's initialization. This should only be done afterwards in an `events.INITIALIZED` handler. If you wrap your `io.open_file()` and `buffer.new()` calls in such a handler, does the problem go away?

Cheers,
Mitchell

--
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.
-- 
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 Mon 29 Jul 2019 - 14:13:29 EDT

This archive was generated by hypermail 2.2.0 : Tue 30 Jul 2019 - 06:50:55 EDT