Key commands in menu

From: Robert <ro....at.web.de>
Date: Tue, 29 Mar 2011 15:16:09 +0200

Hi,

there was some Textadept discussion on the Lua mailing list[1] with
questions about key commands displayed in the menu.

Mitchell,
have you considered creating a string representation of the keys table
entries and using these in the menu creation?
For the table entries I iterate over them and concatenate their string
representations for a key.
I tested this and it works for simple functions and table entries like
{ _buffer.save, _buffer } but not for those buffer functions that are
not set within Textadept because the function, e.g. _buffer.undo, is
not the same in the menubar and keys tables.
I think with the old string based approach this might be possible but
I'm not sure about the new metatable based approach.
It's of course not fully dynamic, but you could do

keys.cn = nil
keys.an = new_buffer
_m.textadept.menu.set_menubar(_m.textadept.menu.menubar)

and the menu is updated.

Robert

[1] http://lua-users.org/lists/lua-l/2011-03/threads.html#00867
Received on Tue 29 Mar 2011 - 09:16:09 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:03:54 EST