diff options
author | 2015-01-29 12:53:28 -0500 | |
---|---|---|
committer | 2015-01-29 12:53:28 -0500 | |
commit | 1dabff6ee09d8c1bc382aba4c17ce99cf301776e (patch) | |
tree | dd0de03a76b7f5ea3853659d2a60da99f0a96911 | |
parent | 2eef170741c3ddcc4528b26b6f08750f00149bad (diff) | |
download | textadept-1dabff6ee09d8c1bc382aba4c17ce99cf301776e.tar.gz textadept-1dabff6ee09d8c1bc382aba4c17ce99cf301776e.zip |
Removed language-specific context menus.
Editing `textadept.menu.context_menu` directly is good enough.
-rw-r--r-- | core/._M.luadoc | 40 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 13 |
2 files changed, 18 insertions, 35 deletions
diff --git a/core/._M.luadoc b/core/._M.luadoc index 7030af69..97aa3aa9 100644 --- a/core/._M.luadoc +++ b/core/._M.luadoc @@ -10,7 +10,8 @@ -- -- Textadept modules are identical to Lua modules and behave in the same way. -- Modules consist of a single directory with an *init.lua* script and any --- necessary support files. (For an example, see *modules/textadept/init.lua*.) +-- necessary support files. (For an example, see *modules/textadept/init.lua*, +-- which is a module that provides most of Textadept's functionality.) -- -- Loaded modules, even language modules, persist in Textadept's Lua State; -- Textadept never unloads them. Therefore, modules should define functions or @@ -18,10 +19,13 @@ -- -- ### Language Modules -- --- To fully take advantage of Textadept's features, language modules should have --- at a minimum: run and/or compile commands, an event handler for setting --- buffer properties like indentation, and if possible, an autocompleter. --- Optional features are extra snippets and commands and a context menu. +-- Language modules are a special kind of module that Textadept automatically +-- loads when editing source code in a particular programming language. When +-- writing a language module, and in order to fully take advantage of +-- Textadept's features, you should include at a minimum: run and/or compile +-- commands, an event handler for setting buffer properties like indentation, +-- and if possible, an autocompleter. Optional features are extra snippets, +-- commands, and context menu items. -- -- #### Compile and Run -- @@ -67,7 +71,7 @@ -- -- #### Buffer Properties -- --- By default, Textadept uses 2 spaces as indentation. If your language has +-- By default, Textadept uses 2 spaces for indentation. If your language has -- different indentation guidelines, change them from an -- `events.LEXER_LOADED` event handler. Using tabs of width 8 would look like -- @@ -85,7 +89,8 @@ -- documentation, respectively, when editing code. In order for these to work -- for your language, you must create an -- [autocompleter](#textadept.editing.autocompleters) and --- [API file(s)](#textadept.editing.api_files). +-- [API file(s)](#textadept.editing.api_files). All of Textadept's included +-- language modules have examples of autocompleters and API documentation. -- -- #### Snippets -- @@ -107,9 +112,9 @@ -- to the end of the current line and insert a new line. Both are bound to the -- `Shift+Enter` (`⇧↩` on Mac OSX | `S-Enter` in curses) key for easy access. -- --- -- In file *lua/init.lua* | -- In file *cpp/init.lua* +-- -- In file *lua/init.lua* | -- In file *ansi_c/init.lua* -- | --- function M.try_to_autocomplete_end() | keys.cpp = { +-- function M.try_to_autocomplete_end() | keys.ansi_c = { -- ... | ['s\n'] = function() -- end | buffer:line_end() -- | buffer:add_text(';') @@ -119,21 +124,12 @@ -- -- #### Context Menu -- --- Language-specific context menus, accessible by right-clicking inside the --- view, are useful for accessing module features without using key bindings. +-- It may be useful to add language-specific menu options to the right-click +-- context menu in order to access module features without using key bindings. -- For Lua this might look like -- --- M.context_menu = { --- {_L['_Undo'], buffer.undo}, --- {_L['_Redo'], buffer.redo}, --- {''}, --- {_L['Cu_t'], buffer.cut}, --- {_L['_Copy'], buffer.copy}, --- {_L['_Paste'], buffer.paste}, --- {_L['_Delete'], buffer.clear}, --- {''}, --- {_L['Select _All'], buffer.select_all}, --- {''}, +-- textadept.menu.context_menu[#textadept.menu.context_menu + 1] = { +-- title = 'Lua', -- {'Autocomplete "end"', M.try_to_autocomplete_end} -- } module('_M')]] diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index a99f14ad..cb27174f 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -413,19 +413,6 @@ events.connect(events.MENU_CLICKED, function(menu_id) keys.run_command(action, type(action)) end) -if not CURSES then - -- Set a language-specific context menu or the default one. - local function set_language_contextmenu() - local lang = _G.buffer:get_lexer() - set_contextmenus(_M[lang] and _M[lang].context_menu, - _M[lang] and _M[lang].tab_context_menu) - end - events.connect(events.LEXER_LOADED, set_language_contextmenu) - events.connect(events.BUFFER_AFTER_SWITCH, set_language_contextmenu) - events.connect(events.VIEW_AFTER_SWITCH, set_language_contextmenu) - events.connect(events.BUFFER_NEW, set_language_contextmenu) -end - return setmetatable(M, { __index = function(t, k) return proxies[k] or M[k] end, __newindex = function(t, k, v) |