Re: [code][textadept] Some questions about buffer.set_theme()

From: Pedro Andres Aranda Gutierrez <>
Date: Wed, 7 Feb 2018 08:44:25 +0100

Hi Barna,

I have something like

if CURSES then
         font = fname,
         fontsize = fsize,
         ['style.linenumber'] = lnstyle,

in my .textadept/init.lua. Since I do a lot of customisation depending on
the OS, I have variables for almost everything: ftheme is the theme name,
fname is the font name, fsize is the font size, etc. etc.
Note that you may want to treat the CURSES case too. Would be interesting
to know whether your concept works out. Just try it out ;-) Edit the code.
In the most catastrophic case, you may need vi to clean garbage ;-)

Best, /PA

On 7 February 2018 at 00:09, Keresztes Barna <> wrote:

> Hi,
> I have some questions about the behavior of the buffer.set_theme()
> function.
> 1. It sets the theme only at the startup and for every buffer, it's
> clearly a function affecting the UI (like, not a buffer-level
> function (properties that can be different for every buffer - like tab
> width or margin). So I don't really understand why was it moved from the ui
> class to buffer class?
> 2. I understand that it works only at startup, but I don't find it normal
> that subsequent calls give "nil value" error (as it's an API function). IMO
> it should do nothing or give a warning.
> 3. The most interesting question: It should be really interesting to be
> able to define a different theme for different buffers. I like to have a
> light theme for text editing (LaTex, Markdown) and a dark theme for code.
> Something like:
> events.connect(events.LEXER_LOADED, function(lang)
> if lang == 'markdown' or lang == 'latex' then
> buffer.set_theme(not CURSES and 'base16-tomorrow-light')
> else
> buffer.set_theme(not CURSES and 'base16-monokai-dark')
> end
> end
> I don't think there is a technical obstacle as I found a workaround by
> replacing `buffer.set_theme` by `dofile('path/to/theme.lua')`.
> Could you implement the per buffer theme feature?
> Second question: Is there any recommendation against using the dofile
> workaround?
> Thanks!
> Barna

Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellet zu werden
Georg Kreisler
You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Wed 07 Feb 2018 - 02:44:25 EST

This archive was generated by hypermail 2.2.0 : Wed 07 Feb 2018 - 06:26:07 EST