Re: [code] Some advice on textadept programming

From: Mitchell <>
Date: Tue, 3 Feb 2015 13:53:16 -0500 (EST)

Hi Carlos,

On Tue, 3 Feb 2015, Carlos Pita wrote:

> Hi all,
> say I could babble some lua and I wanted to code a new ta module or
> some advanced configuration. In that case I would need some advice
> from the savvy:
> 1) How do you reload and inspect your changes? [1] I know that C-e
> opens the command entry, but I'm looking for concrete advice: do you
> run something like "reset(); my_function()" or what?

That's what I do.

> 2) How do you debug or trace your changes? Do you just io.print?

It depends on what I'm debugging/tracing and in which version of
Textadept. If printing to the print buffer is okay, then I'll just do
`ui.print()`. If I don't want to print to the print buffer and am using
GUI Textadept, I'll use `_G.print()`, Textadept from a terminal, and read
any stdout. If I'm using terminal Textadept, I'll use `ui.statusbar_text`
as Robert mentioned.

> 3) In general: do you have any useful patterns or techniques to share?

I'm afraid I cannot offer much in this because after hacking on Textadept
for 8 years, I have a good intuition of why something goes wrong and
where; I don't have to spend much time, if any, doing low-level debugging.

I will say that knowing how packages/modules work in Lua greatly aids in
understanding Textadept's overall structure and module structure. I think
newcomers often struggle trying to understand which `init.lua` goes where,
why a certain `init.lua` and `post_init.lua` are only run once, etc.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Tue 03 Feb 2015 - 13:53:16 EST

This archive was generated by hypermail 2.2.0 : Wed 04 Feb 2015 - 06:44:45 EST