Re: [code] textadept indent to correct level

From: Mitchell <m.att.foicica.com>
Date: Sun, 8 Jun 2014 16:55:27 -0400 (EDT)

Hi Joseph,

On Sun, 8 Jun 2014, Joseph McDonald wrote:

> On 06/08/2014 01:28 AM, Robert Gieseke wrote:
>
>> Surely possible, but as far as I know nobody has written a functionality
>> like this for Textadept yet and Emacs needs rules for indenting in major
>> modes etc. I think
>
> OK, I will look into it. If anyone has any pointers, I'm all ears.

I'll think of something later, but I have time to reply to your other
questions now.

>>> also, how do I bind a key to "reset" to reload my init.lua and all
>>> modules?
>>
>> E.g. for 'F9', in your 'init.lua':
>>
>> keys.f9 = reset
>
> perfect! thanks! it would be neat if saving any file in the
> ~/.textadept directory invoked reset automagically.

Something like the following should work:

   events.connect(events.FILE_AFTER_SAVE, function(filename)
     if filename:find('[/\\]%.textadept[/\\]') then reset() end
   end)

> Now I'm trying to get a few more of my emacs keys in place, I have:
>
> keys['cx'] = {
> u = buffer.undo,
> cc = quit,
> cf = io.open_file,
> cs = buffer.save,
> cw = buffer.save_as,
> }
>
> ctrl-x u works fine as undo.
> ctrl-x ctrl-c works fine.
>
> ctrl-x ctrl-f works just fine. although I would like to bind it to
> textredux file picker. i have hijack mode on, not sure what else i need
> to do.
>
> ctrl-x ctrl-s gives "invalid sequence" in the message area
> ctrl-x ctrl-w gives "invalid sequence" in the message area
>
> any idea why?

`buffer.save` and `buffer.save_as` do not exist. Use `io.save_file`
and `io.save_file_as` instead. (*modules/textadept/keys.lua* contains
pretty much all API functions assignable to keys.)

> also, i'd like to have a key stroke "c " that will start selection mode,
> so that all navigation changes the range of the selection (in emacs this
> is called "set-mark"). Is such a thing possible in textadept?

This feature exists in the terminal version of Textadept by default, but
not the GUI version; you'll have to enable it yourself. Search in
*modules/textadept/keys.lua* for 'c^' and 'c]'.

> also , is it possible to use the "esc" key in a sequence?
> for instance, hitting esc then hitting "w" to copy selection, or hit
> esc, then hit "u" to uppercase the string under the cursor.

Yes, redefine `keys.CLEAR`[1].

> one last thing: how to alter the path that textadept looks to when
> "require" is called? It would be nice if it worked for things that were
> installed with luarocks system. So we could install a package with
> luarocks and it is then accessible from within textadept without any
> fiddling.

Change Textadept's `package.path` and `package.cpath` as you normally
would for Lua scripts. Textadept's *init.lua* has an example.

Cheers,
Mitchell

[1]: http://foicica.com/textadept/api/keys.html#CLEAR

-- 
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 Sun 08 Jun 2014 - 16:55:27 EDT

This archive was generated by hypermail 2.2.0 : Mon 09 Jun 2014 - 06:30:21 EDT