* insert pair doesn't work with *, $ and %
@ 2006-12-07 3:09 Dieter Wilhelm
2006-12-07 3:32 ` Andreas Seltenreich
0 siblings, 1 reply; 3+ messages in thread
From: Dieter Wilhelm @ 2006-12-07 3:09 UTC (permalink / raw)
Hi
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?
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: insert pair doesn't work with *, $ and %
2006-12-07 3:09 Dieter Wilhelm
@ 2006-12-07 3:32 ` Andreas Seltenreich
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Seltenreich @ 2006-12-07 3:32 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: insert pair doesn't work with *, $ and %
[not found] <mailman.1624.1165460982.2155.help-gnu-emacs@gnu.org>
@ 2006-12-07 3:47 ` Katsumi Yamaoka
0 siblings, 0 replies; 3+ messages in thread
From: Katsumi Yamaoka @ 2006-12-07 3:47 UTC (permalink / raw)
>>>>> In <mailman.1624.1165460982.2155.help-gnu-emacs@gnu.org>
>>>>> Dieter Wilhelm wrote:
> 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?
You need to add to the `insert-pair-alist' variable the pairs
corresponding to those keys. For example:
(add-to-list 'insert-pair-alist '(?* ?*))
(add-to-list 'insert-pair-alist '(?$ ?$))
(add-to-list 'insert-pair-alist '(?% ?%))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-12-07 3:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.1624.1165460982.2155.help-gnu-emacs@gnu.org>
2006-12-07 3:47 ` insert pair doesn't work with *, $ and % Katsumi Yamaoka
2006-12-07 3:09 Dieter Wilhelm
2006-12-07 3:32 ` Andreas Seltenreich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).