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

From: Keresztes Barna <>
Date: Sat, 10 Feb 2018 14:55:40 +0100

On Wed, 7 Feb 2018 10:11:57 Mitchell wrote:
> > Second question: Is there any recommendation against using the dofile
> >workaround?
> No, there is no recommendation against. That will work.

Thanks for the answers, Mitchell!
So I wrote a small module based on the original `set_theme` function that
enables the per-buffer theming, I'll share it with the community:

function set_buffer_theme(name, props)
  name = name:find('[/\\]') and name or
         package.searchpath(name, _USERHOME..'/themes/?.lua;'..
  if not name or not lfs.attributes(name) then return end
  props = props or {}
  for prop, value in pairs(props) do[prop] = value end

It can be used at the LEXER_LOADED event to set the buffer theme based on
the file type.
There is only a small bug: When opening a new file, the themes might be
mixed: some elements have the background color of the startup theme. To
correct is, switch to another tab, then switch back to the current tab: the
colors will be fine.
If somebody has an idea how to correct this, I would be happy to correct
the code :)

You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sat 10 Feb 2018 - 08:55:40 EST

This archive was generated by hypermail 2.2.0 : Sun 11 Feb 2018 - 06:51:00 EST