Re: [code] [textadept] History for TA

From: Mitchell <m.att.foicica.com>
Date: Tue, 30 Jul 2019 14:14:24 -0400 (EDT)

Hi,

On Tue, 30 Jul 2019, Qwerky wrote:

> Hello David,
>
> On 2019-07-30 09:19, David Reimer wrote:
>> Hi qwerky -
>> Thanks for this! Sometimes the "Open Recent..." menu item gives me a
>> list I don't expect :) so I thought I would try out this module. It
>> looks promising, and it's nice to have those added features!
>>
>> One thing about installation: I found I needed (?) to tweak things
>> slightly to get it to load properly:
>>
>> 1. Made "history" directory under my `/home/user/.textadept/modules`
>> directory (I'm on Ubuntu 18.04 LTS at the moment);
>> 2. Copied your "history.lua" file into it, and renamed to "init.lua";
>> 3. Added `_M.history = require('history')` to my user's "init.lua" file.
>>
>> Then all worked as advertised. Thanks for sharing this!
>>
>> David
>
> Thanks for the feedback!  You are right, of course.  The simple instructions
> I gave were for those who have a 'common' directory for common modules, and
> use that code from the wiki to automatically require the modules in that
> directory.
>
> But for those whose like to place each module in its own directory, I believe
> that your steps are entirely correct, as well they should be, since you are a
> much more advanced user than I. Thanks for providing those steps for other
> users as well.  And I'm glad to hear that it works correctly on Linux as
> well.
>
> A question that your step 3 and '_M.history' brought to mind:  as a
> relatively new user, I am somewhat confused by using 'M.function' or
> 'M.variable' in the module, as opposed to 'local function' or 'local
> variable'.  What is the difference between the two?

The `M.` prefix makes those fields accessible outside the module (e.g. from one's *~/.textadept/init.lua*). If those fields were local, they are not accessible from the outside.

Cheers,
Mitchell

-- 
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 30 Jul 2019 - 14:14:24 EDT

This archive was generated by hypermail 2.2.0 : Wed 31 Jul 2019 - 06:48:39 EDT