diff options
-rw-r--r-- | core/._m.lua | 6 | ||||
-rw-r--r-- | core/.textadept.lua | 21 | ||||
-rw-r--r-- | init.lua | 1 |
3 files changed, 27 insertions, 1 deletions
diff --git a/core/._m.lua b/core/._m.lua index 2ba1077a..5a6d309a 100644 --- a/core/._m.lua +++ b/core/._m.lua @@ -37,3 +37,9 @@ module('_m') -- When assigning key commands to module functions, do not forget to do so AFTER -- the function has been defined. Typically key commands are placed at the end -- of files, like commands.lua in language-specific modules. + +--- +-- This module contains no functions. +function no_functions() + +end diff --git a/core/.textadept.lua b/core/.textadept.lua index 954c83ee..4675a994 100644 --- a/core/.textadept.lua +++ b/core/.textadept.lua @@ -14,12 +14,13 @@ module('textadept') -- @field title The title of the Textadept window. -- @field focused_doc_pointer The pointer to the document associated with the -- buffer of the currently focused view. (Used internally; read-only) +-- @field menubar A table of GTK menus defining a menubar (write-only). -- @field clipboard_text The text on the clipboard (read-only). -- @field statusbar_text The text displayed by the statusbar (write-only). -- @field docstatusbar_text The text displayed by the doc statusbar -- (write-only). textadept = { title = nil, focused_doc_pointer = nil, clipboard_text = nil, - statusbar_text = nil, docstatusbar_text = nil } + menubar = nil, statusbar_text = nil, docstatusbar_text = nil } --- -- A numerically indexed table of open buffers in Textadept. @@ -60,6 +61,24 @@ function get_split_table() end function focus_command() end --- +-- Creates a GTK menu, returning the userdata. +-- @param menu_table A table defining the menu. It is an ordered list of strings +-- that are handled as follows: +-- 'gtk-*' - a stock menu item is created based on the GTK stock-id. +-- 'separator' - a menu separator item is created. +-- Otherwise a regular menu item with a mnemonic is created. +-- An additional 'title' key can be used to define the menu's title text (if it +-- is a submenu). +-- @see popupmenu +function gtkmenu(menu_table) end + +--- +-- Pops up a GTK menu at the cursor. +-- @param menu The menu userdata returned by gtkmenu. +-- @see gtkmenu +function popupmenu(menu) + +--- -- Checks if the buffer being indexed is the currently focused buffer. -- This is necessary because any buffer actions are performed in the focused -- views' buffer, which may not be the buffer being indexed. Throws an error @@ -7,6 +7,7 @@ require 'ext/mime_types' local mpath = _HOME..'modules/?.lua;'.._HOME..'/modules/?/init.lua' package.path = package.path..';'..mpath +-- modules to load on startup require 'textadept' local textadept = textadept |