Re: [code] Disable ' pairing for Scheme in Textadept?

From: Robert <rob.g.att.web.de>
Date: Mon, 15 Apr 2013 19:54:54 +0200

Hi Źmicier,

On Mon, Apr 15, 2013 at 6:18 PM, Дмитрий <dmymd.att.yandex.by> wrote:
> Hello!
>
> How can I disable autopairing of apostrophes for Scheme lexer while keeping it for others?
> (By the way, it would be safe as a default setting for Scheme and Lisp lexers, since these languages don’t need paired apostrophes.)
>

you have two options, I think. You could create your own little scheme
module, in which you set the
`_M.textadept.editing.char_matches.scheme` table to include only the
chars you like to have matched:

Something like this (untested), in
`.textadept/modules/scheme/init.lua`, that would only match parens:

local M = {}

-- Auto-matching chars.
m_editing.char_matches.scheme = {
  [40] = ')',
}

-- Sets default buffer properties for Scheme files.
function M.set_buffer_properties()
 -- ...
end

return M

You can add the chars you want to be matched there of course (if you
use a Scheme that allows brackets for example).
Here is an example in my Markdown module, where I disable apostrophe
and add < for HTML:
http://rgieseke.github.io/ta-markdown/#section-6

The other way could be to assign keyboard shortcuts to toggle auto
pairing on and off, for example in your `init.lua`:
-- Ctrl-1
keys['c1'] = function()
  _M.textadept.editing.AUTOPAIR = not _M.textadept.editing.AUTOPAIR
  gui.statusbar_text = 'Auto pairing '..tostring(_M.textadept.editing.AUTOPAIR)
end

A function like this might occasionally be useful in all languages to
untangle something.

Hope this helps, let us know if you have any questions
Robert

>
> Changing line 69 in modules/textadept/editing.lua to comment out [39] = "'", works, but it disables ' auto-matching in all the languages, and it may be useful e.g. in JavaScript.
>
> --
> Yours sincerely,
> Źmicier Kušnaroŭ
> --
> 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 Mon 15 Apr 2013 - 13:54:54 EDT

This archive was generated by hypermail 2.2.0 : Tue 16 Apr 2013 - 06:45:57 EDT