[code] [textadept] On contextmenu

From: Richard Philips <richard.philips.att.gmail.com>
Date: Wed, 15 May 2013 14:40:24 +0200

In Textadept release 6.6, _M.textadept.menu.contextmenu is taken out of
the API.
It is now possible to specify a language specific contextmenu.
This is accomplished by the following code in modules/textadept/menu.lua:


    339 if not CURSES then

    362 -- Set a language-specific context menu or the default one.

    363 local function set_language_contextmenu()

    364 local lang = _G.buffer:get_lexer(true)

    365 M.set_contextmenu(_M[lang] and _M[lang].context_menu or

    366 end

    367 events.connect(events.LANGUAGE_MODULE_LOADED,

    368 events.connect(events.BUFFER_AFTER_SWITCH,

    369 events.connect(events.VIEW_AFTER_SWITCH, set_language_contextmenu)

    370 events.connect(events.BUFFER_NEW, set_lang_contextmenu)

    371 end


    373 return M

I propose the following change to line 365:

    365 M.set_contextmenu(_M[lang] and _M[lang].context_menu or
_M['default'] and _M['default'].context_menu or context_menu)

This change allows for a default context menu which can be (optionally)
specified in

But perhaps there is a better way to get the same result.|


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 Wed 15 May 2013 - 08:40:24 EDT

This archive was generated by hypermail 2.2.0 : Thu 16 May 2013 - 06:46:20 EDT