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

From: Keresztes Barna <kbarna.att.gmail.com>
Date: Tue, 6 Feb 2018 19:29:43 +0100

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 ui.menu), 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')
         buffer.set_theme(not CURSES and 'base16-monokai-dark')

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


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 Tue 06 Feb 2018 - 13:29:43 EST

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