Re: [code] buffer:set_theme does not work

From: Milind Gupta <milind.gupta.att.gmail.com>
Date: Tue, 10 Apr 2018 15:41:29 -0700

Hi Micthell,
      In the init.lua in the textadept folder I placed the statement in the
end:

dofile("Path/To/My/init.lua")

My init.lua looks like this:

buffer:set_theme("E:/Tools/textadept/themes/milind.lua")
buffer.zoom = -2
buffer.tab_width = 4

require 'common.findall'

buffer.scroll_width_tracking = true

-- Events

events.connect(events.DOUBLE_CLICK,function(string)
        -- Get the word
        local cp = buffer.current_pos
        local fl = buffer.first_visible_line
        local buf = buffer
        --local cp = buffer.current_pos
        local pos = findAllAtCursor()
        for i = 1,#pos do
            buffer:add_selection(pos[i][2],pos[i][1])
        end
        buffer:add_selection(cp, cp)
    end
)

So this does not apply the theme to a file when I open it. If I do reset in
command entry the theme gets applied.

On Tue, Apr 10, 2018 at 11:26 AM, Mitchell <m.att.foicica.com> wrote:

> Hi Milind,
>
> On Mon, 9 Apr 2018, Milind Gupta wrote:
>
> Hi Mitchell,
>> I have that command in my init.lua already and that is why reset works
>> because it already knew I had set the theme. But it does not load it
>> automatically. I am using textadept on Windows 7.
>>
>
> Is your `buffer:set_theme()` call by itself in your init.lua? (e.g. not in
> a function, event handler, etc.) Starting in version 10, Textadept monitors
> any direct `buffer` API calls and applies those exact calls to subsequent
> buffers. This includes `buffer:set_theme()`. If that call happens
> indirectly (e.g. event handler, key command, etc.), the theme settings will
> not apply to subsequent buffers.
>
> You can also temporarily create a new init.lua with only your
> `buffer:set_theme()` and see if that works. If so, there's something else
> in your init.lua that is causing trouble.
>
> Cheers,
> Mitchell
>
>
>
>> Thanks,
>> Milind
>>
>> On Sun, Apr 8, 2018 at 7:54 AM, Mitchell <m.att.foicica.com> wrote:
>>
>> Hi Milind,
>>>
>>> On Sun, 8 Apr 2018, Milind Gupta wrote:
>>>
>>> Hi,
>>>
>>>> If I give the path to the theme file like dark.lua like:
>>>>
>>>> buffer:set_theme("Path/To/dark.lua")
>>>>
>>>> it does not get loaded automatically. But after opening a file if I do
>>>> reset in the command entry then I see it applied. Is there something I
>>>> am
>>>> missing here? On opening another file in another tab its the same thing.
>>>> For the theme to be applied I need to do reset after opening the file.
>>>>
>>>>
>>> If you want a theme setting to persist, put that `buffer:set_theme(...)`
>>> call in your *~/.textadept/init.lua* file.
>>>
>>> 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.
>>>
>>>
>>>
>>
> 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 Tue 10 Apr 2018 - 18:41:29 EDT

This archive was generated by hypermail 2.2.0 : Wed 11 Apr 2018 - 06:46:56 EDT