[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: insert pair doesn't work with *, $ and %
From: |
Andreas Seltenreich |
Subject: |
Re: insert pair doesn't work with *, $ and % |
Date: |
Thu, 07 Dec 2006 04:32:03 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) |
Dieter Wilhelm writes:
> For a special mode I'd like to have key bindings duplicating various
> characters like e. g.
>
> (global-set-key "\C-c{" 'insert-pair)
>
> this does work as expected (I'm getting a pair of {} and the point is
> within the pair). But I can't get the analogous with *, $ and % to
> run, I'm just getting one of these characters back and not a pair.
> What am I missing here?
My first thought was that the function might look up the pairs in the
current buffer's syntax table, similar to the commands for
sexp-movement, but in fact it has it's own alist:
,----[ C-h f insert-pair RET ]
| If arguments open and close are nil, the character pair is found
| from the variable `insert-pair-alist' according to the last input
| character with or without modifiers. If no character pair is
| found in the variable `insert-pair-alist', then the last input
| character is inserted arg times.
`----
E.g., (add-to-list 'insert-pair-alist '(?% ?%))
regards,
andreas