Re: [code] Textadept Customization and Upgrades

From: Gavin Holt <holtgavin.att.gmail.com>
Date: Tue, 10 Mar 2020 13:19:05 +0000

Hi Mitchell,

Many thanks I will iterate the menu and update the function. My Lua skills
are still on the small turtle and I will research why that table won't
iterate with pairs.

Clarke's third law seems appropriate:

Any sufficiently advanced technology
<https://en.m.wikipedia.org/wiki/Technology> is indistinguishable from magic
<https://en.m.wikipedia.org/wiki/Magic_%28supernatural%29>.

Kind Regards Gavin

On Tue, 10 Mar 2020, 13:09 Mitchell, <m.att.foicica.com> wrote:

> Hi Gavin,
>
> On Tue, 10 Mar 2020, Gavin Holt wrote:
>
> > [snip]
>
> I'll address your other questions later, but I can give a quick answer to
> the following.
>
> > Q3 . I am struggling to reassign a menu entry to a redefined function
> > - see new io.open_recent_file() in my init.lua.
> >
> >
> > I am trying to alter the table textadept.menu.menubar[_L['_File']] but
> > I can't iterate to find the right spot to make an alteration.
> >
> >
> > Test case "for i,v in pairs(textadept.menu.menubar[_L['_File']]) do
> > print(type(v)) end" returns nothing - despite
> > print(#textadept.menu.menubar[_L['_File']]) returning 17!
>
> You need to use the `for i = 1, #menubar[...]` construct to iterate over
> menus. (`pairs` does not work because menu handing is mostly magic in order
> to support instantaneous inserting and removing of items.) See this[1] for
> an example of inserting a "Spellcheck" menu item in alphabetical order in
> the "Tools" menu.
>
> Cheers,
> Mitchell
>
> [1]:
> https://foicica.com/hg/textadept_modules/file/2c38a48b8649/spellcheck/init.lua#l256
> --
> 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 Mar 2020 - 09:19:05 EDT

This archive was generated by hypermail 2.2.0 : Wed 11 Mar 2020 - 06:45:37 EDT