* How to avoid insert anything without switching to read only
@ 2005-07-09 8:43 Lennart Borgman
2005-07-10 5:19 ` Richard M. Stallman
2005-07-11 13:37 ` Stefan Monnier
0 siblings, 2 replies; 9+ messages in thread
From: Lennart Borgman @ 2005-07-09 8:43 UTC (permalink / raw)
In viper-mode nothing should be inserted if you are in vi mode. It works
for all keys that are assigned commands (like i, o, a etc), but it does
not work for national characters. Those are not assigned to anything in
viper. I suggested to the maintainer that this should be fixed by
advising `self-insert'. Those national characters are bound to
self-insert according to help (C-h c). Michael was very helpful and
added this.
However to my surprise it does not work. I have tried to find out why.
It seems like the adise is not called. I suspect that it has something
to do with key-translation-map where it looks like those characters are
translated with `encoded-kbd-self-insert-ccl' if I understand this
correctly.
How can this be handled?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to avoid insert anything without switching to read only
2005-07-09 8:43 How to avoid insert anything without switching to read only Lennart Borgman
@ 2005-07-10 5:19 ` Richard M. Stallman
2005-07-10 22:09 ` Kim F. Storm
2005-07-11 13:37 ` Stefan Monnier
1 sibling, 1 reply; 9+ messages in thread
From: Richard M. Stallman @ 2005-07-10 5:19 UTC (permalink / raw)
Cc: kifer, emacs-devel
When you put advice on primitive functions,
it only works when they are called from Lisp code.
The command loop calls self-insert directly in
a special way, so your advice is not called.
What you should do is rebind those characters to run
another command, one that does your special thing
and calls self-insert.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to avoid insert anything without switching to read only
2005-07-10 5:19 ` Richard M. Stallman
@ 2005-07-10 22:09 ` Kim F. Storm
2005-07-10 22:30 ` Lennart Borgman
0 siblings, 1 reply; 9+ messages in thread
From: Kim F. Storm @ 2005-07-10 22:09 UTC (permalink / raw)
Cc: Lennart Borgman, kifer, emacs-devel
"Richard M. Stallman" <rms@gnu.org> writes:
> When you put advice on primitive functions,
> it only works when they are called from Lisp code.
> The command loop calls self-insert directly in
> a special way, so your advice is not called.
>
> What you should do is rebind those characters to run
> another command, one that does your special thing
> and calls self-insert.
Or use the command remap feature.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to avoid insert anything without switching to read only
2005-07-10 22:09 ` Kim F. Storm
@ 2005-07-10 22:30 ` Lennart Borgman
2005-07-10 23:05 ` David Kastrup
2005-07-11 8:09 ` Kim F. Storm
0 siblings, 2 replies; 9+ messages in thread
From: Lennart Borgman @ 2005-07-10 22:30 UTC (permalink / raw)
Cc: rms, kifer, emacs-devel
Kim F. Storm wrote:
>"Richard M. Stallman" <rms@gnu.org> writes:
>
>
>
>>When you put advice on primitive functions,
>>it only works when they are called from Lisp code.
>>The command loop calls self-insert directly in
>>a special way, so your advice is not called.
>>
>>What you should do is rebind those characters to run
>>another command, one that does your special thing
>>and calls self-insert.
>>
>>
>
>Or use the command remap feature.
>
>
Thanks, but I am not able to understand how to apply any of your
suggestions in a case like this. The problem is that the keyboard keys
to change are all those that are outside a set of those defined to
useful things (say a-z for simplicity). All other keys should be defined
to do nothing. There are plenty of potential keys (65K). It does not
seem to be possible to handle them all separately.
Can you please explain a little bit more in detail how you think this
could be done? Could the actual available keyboard keys in a specific
situation in some way be listed?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to avoid insert anything without switching to read only
2005-07-10 22:30 ` Lennart Borgman
@ 2005-07-10 23:05 ` David Kastrup
2005-07-10 23:32 ` Lennart Borgman
2005-07-11 8:09 ` Kim F. Storm
1 sibling, 1 reply; 9+ messages in thread
From: David Kastrup @ 2005-07-10 23:05 UTC (permalink / raw)
Cc: emacs-devel, rms, kifer, Kim F. Storm
Lennart Borgman <lennart.borgman.073@student.lu.se> writes:
> Kim F. Storm wrote:
>
>>"Richard M. Stallman" <rms@gnu.org> writes:
>>
>>>What you should do is rebind those characters to run
>>>another command, one that does your special thing
>>>and calls self-insert.
>>>
>>>
>>
>>Or use the command remap feature.
>>
> Thanks, but I am not able to understand how to apply any of your
> suggestions in a case like this. The problem is that the keyboard
> keys to change are all those that are outside a set of those defined
> to useful things (say a-z for simplicity). All other keys should be
> defined to do nothing. There are plenty of potential keys (65K). It
> does not seem to be possible to handle them all separately.
>
> Can you please explain a little bit more in detail how you think
> this could be done? Could the actual available keyboard keys in a
> specific situation in some way be listed?
I don't understand why it is worth doing in the first place. Why not
just let those characters self-insert? They don't have any other
meaning in vi. What use is it to have them beep?
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to avoid insert anything without switching to read only
2005-07-10 22:30 ` Lennart Borgman
2005-07-10 23:05 ` David Kastrup
@ 2005-07-11 8:09 ` Kim F. Storm
1 sibling, 0 replies; 9+ messages in thread
From: Kim F. Storm @ 2005-07-11 8:09 UTC (permalink / raw)
Cc: rms, kifer, emacs-devel
Lennart Borgman <lennart.borgman.073@student.lu.se> writes:
> Thanks, but I am not able to understand how to apply any of your
> suggestions in a case like this. The problem is that the keyboard keys
> to change are all those that are outside a set of those defined to
> useful things (say a-z for simplicity). All other keys should be
> defined to do nothing. There are plenty of potential keys (65K). It
> does not seem to be possible to handle them all separately.
I'm not sure I understand exactly what's the problem here.
If those characters are NOT bound to any command, how do they get
inserted in a buffer by viper? If viper calls read-event or read-char
directly to read those characters, it must interpret them too...
Otherwise, viper must rely on the normal read event loop to
find the command bound to those keys. Let's say they are
all bound to self-insert-unusual-char-command.
Then you can remap that command to a viper equivalent, or
even ignore them directly, directly in the relevant viper
key map, e.g.
(define-key viper-xyz-map [remap self-insert-unusual-char-command]
'viper-ignore-char)
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to avoid insert anything without switching to read only
2005-07-09 8:43 How to avoid insert anything without switching to read only Lennart Borgman
2005-07-10 5:19 ` Richard M. Stallman
@ 2005-07-11 13:37 ` Stefan Monnier
2005-07-11 13:52 ` Lennart Borgman
1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2005-07-11 13:37 UTC (permalink / raw)
Cc: Michael Kifer, Emacs Devel
> In viper-mode nothing should be inserted if you are in vi mode. It works for
> all keys that are assigned commands (like i, o, a etc), but it does not work
> for national characters. Those are not assigned to anything in
> viper. I suggested to the maintainer that this should be fixed by advising
> self-insert'. Those national characters are bound to self-insert according
> to help (C-h c). Michael was very helpful and added this.
(define-key the-viper-map-for-vi-mode [remap self-insert-command] 'undefined)
-- Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to avoid insert anything without switching to read only
2005-07-11 13:37 ` Stefan Monnier
@ 2005-07-11 13:52 ` Lennart Borgman
0 siblings, 0 replies; 9+ messages in thread
From: Lennart Borgman @ 2005-07-11 13:52 UTC (permalink / raw)
Cc: Michael Kifer, Emacs Devel
Stefan Monnier wrote:
>>In viper-mode nothing should be inserted if you are in vi mode. It works for
>>all keys that are assigned commands (like i, o, a etc), but it does not work
>>for national characters. Those are not assigned to anything in
>>viper. I suggested to the maintainer that this should be fixed by advising
>>self-insert'. Those national characters are bound to self-insert according
>>to help (C-h c). Michael was very helpful and added this.
>>
>>
>
> (define-key the-viper-map-for-vi-mode [remap self-insert-command] 'undefined)
>
>
Thanks! I hope it is solved. The actual code is
(define-key viper-vi-basic-map [remap self-insert-command] 'undefined)
Wonder where and when it should be called? Can you try to add that Michael?
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-07-11 13:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-09 8:43 How to avoid insert anything without switching to read only Lennart Borgman
2005-07-10 5:19 ` Richard M. Stallman
2005-07-10 22:09 ` Kim F. Storm
2005-07-10 22:30 ` Lennart Borgman
2005-07-10 23:05 ` David Kastrup
2005-07-10 23:32 ` Lennart Borgman
2005-07-11 8:09 ` Kim F. Storm
2005-07-11 13:37 ` Stefan Monnier
2005-07-11 13:52 ` Lennart Borgman
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.