[code] [textadept] Key Definition Question

From: Pete Kazmier <pete.att.kazmier.com>
Date: Mon, 1 Apr 2013 12:48:21 -0500

I'm a Lua newbie, Emacs fan (extensibility), terminal lover (tmux) that has
just discovered textadept so naturally I was curious if I could create a
set of keybindings that would satisfy many years of muscle memory. After
looking at the API and code, it seems like this is very plausible given the
presence of key chaining.

I did have a question about assigning functions to key definitions. Why use
this 3rd form:

keys['cn'] = new_buffer
keys['cs'] = buffer.save
keys['a('] = {_M.textadept.editing.enclose, '(', ')'}

Instead of:

keys['cn'] = new_buffer
keys['cs'] = buffer.save
keys['a('] = function() M.textadept.editing.enclose('(',')') end

core/keys.lua has some automagic for the third form to replace references
to 'buffer' and 'view', but with the anonymous function above, you don't
need that magic. The magic also is limited to using a buffer or view as the
first argument.

What am I missing?


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 Mon 01 Apr 2013 - 13:48:21 EDT

This archive was generated by hypermail 2.2.0 : Tue 02 Apr 2013 - 06:30:49 EDT