* 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 insert pair doesn't work with *, $ and % Dieter Wilhelm
@ 2006-12-07 3:32 ` Andreas Seltenreich
2006-12-10 16:01 ` how to differentiate between default interactive argument 1 and user supplied argument 1[was: insert pair doesn't work with *, $ and %] Dieter Wilhelm
0 siblings, 1 reply; 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
* how to differentiate between default interactive argument 1 and user supplied argument 1[was: insert pair doesn't work with *, $ and %]
2006-12-07 3:32 ` Andreas Seltenreich
@ 2006-12-10 16:01 ` Dieter Wilhelm
0 siblings, 0 replies; 3+ messages in thread
From: Dieter Wilhelm @ 2006-12-10 16:01 UTC (permalink / raw)
Cc: help-gnu-emacs
Andreas Seltenreich <seltenreich@gmx.de> writes:
Katsumi Yamaoka <yamaoka@jpl.org> writes:
>>>>>> 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 '(?% ?%))
Hi Andreas and Katsumi
Thank you very much.
I think that insert-pair should duplicate by default every input
character when the characters is not in insert-pair-alist. Except
when the user *prescribes* the numeric argument to 1.
But then, how can one detect programmatically whether the user gives
interactively no argument (default argument 1) and an actual argument
1?
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-12-10 16:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-07 3:09 insert pair doesn't work with *, $ and % Dieter Wilhelm
2006-12-07 3:32 ` Andreas Seltenreich
2006-12-10 16:01 ` how to differentiate between default interactive argument 1 and user supplied argument 1[was: insert pair doesn't work with *, $ and %] Dieter Wilhelm
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.