[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Two Emacs challenges
From: |
Leon |
Subject: |
Re: Two Emacs challenges |
Date: |
Sat, 17 Jun 2006 10:42:08 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux) |
William Xu <william.xwl@gmail.com> writes:
> Leon <sdl.web@gmail.com> writes:
>
> [...]
>
>> (2) pairs
>>
>> How to bind keys such as (, [, {, " etc to perform such function
>>
>> When type once, it will insert a pair while twice insert itself for
>> example: `[' will insert `[]' and leave the cursor in the middle
>
> Set this,
>
> (setq skeleton-pair t)
> (global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
> (global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
> (global-set-key (kbd "{") 'skeleton-pair-insert-maybe)
>
This is a very nice function. Thanks.
>> while `[[' will insert `['?
>
> i don't understand why you would like this. Suppose we want to write a
> nested list, like '((a) (b)), same insert scheme is still useful.
Sometimes I just want to insert a missing ( or [ etc before a word or
something. But now skeleton-pair-insert-maybe can handle this well.
--
Leon