* How to translate M-kp-multiply to M-* before key is mapped to function?
@ 2004-07-02 15:10 paul
2004-07-02 15:28 ` Kai Grossjohann
2004-07-02 16:32 ` Kevin Rodgers
0 siblings, 2 replies; 8+ messages in thread
From: paul @ 2004-07-02 15:10 UTC (permalink / raw)
Hello all,
I've nearly pulled out my hair for the following problem;
I want to translate M-kp-multiply to M-* *BEFORE* the key
gets bound to its default function (in my case pop-tag-mark).
I do *not* want to use global-set-key but am looking for
a general way to remap non-ascii input events.
Using (define-key function-key-map ...) or (define-key key-translation-map ...)
is too late; I can remap the key, but the function pop-tag-mark is not
called.
Trying an approach with keyboard-translate drives me nuts because
it does not seem to support non-ascii events.
Help!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to translate M-kp-multiply to M-* before key is mapped to function?
2004-07-02 15:10 How to translate M-kp-multiply to M-* before key is mapped to function? paul
@ 2004-07-02 15:28 ` Kai Grossjohann
2004-07-02 16:32 ` Kevin Rodgers
1 sibling, 0 replies; 8+ messages in thread
From: Kai Grossjohann @ 2004-07-02 15:28 UTC (permalink / raw)
litter@graffiti.net (paul) writes:
> I've nearly pulled out my hair for the following problem;
> I want to translate M-kp-multiply to M-* *BEFORE* the key
> gets bound to its default function (in my case pop-tag-mark).
Maybe (global-set-key (kbd "M-<kp_multiply>") (kbd "M-*")) is enough?
Kai
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to translate M-kp-multiply to M-* before key is mapped to function?
2004-07-02 15:10 How to translate M-kp-multiply to M-* before key is mapped to function? paul
2004-07-02 15:28 ` Kai Grossjohann
@ 2004-07-02 16:32 ` Kevin Rodgers
2004-07-04 21:51 ` paul
1 sibling, 1 reply; 8+ messages in thread
From: Kevin Rodgers @ 2004-07-02 16:32 UTC (permalink / raw)
paul wrote:
> I've nearly pulled out my hair for the following problem;
> I want to translate M-kp-multiply to M-* *BEFORE* the key
> gets bound to its default function (in my case pop-tag-mark).
You must be running emacs without a window system (or under a window
system, but with the -nw command line option). In an xterm on my
platform (i386-pc-solaris2.7, X toolkit), `C-h k M-kp-multiply' shows
| ESC * runs the command pop-tag-mark
and then `C-h l' shows
| C-h k ESC * C-h l
The odd thing is that function-key-map contains this entry
(kp-multiply . [42])
but no escape sequence that maps to [kp-multiply] in the way that `ESC [
1 1 ~' is bound to [f1] or `ESC O p' is bound to [kp-1].
> I do *not* want to use global-set-key but am looking for
> a general way to remap non-ascii input events.
What non-ASCII input event do you think your terminal is sending to
Emacs?
> Using (define-key function-key-map ...) or (define-key key-translation-map ...)
> is too late; I can remap the key, but the function pop-tag-mark is not
> called.
Since setting function-key-map and key-translation-map do not change the
results reported by `C-h k' and `C-h l', I don't think they have
anything to do with it: I think it means that the xterm is actually
sending `*' to Emacs, not an escape sequence.
> Trying an approach with keyboard-translate drives me nuts because
> it does not seem to support non-ascii events.
What do you want to do? It seems like you want to bind M-kp-multiply to
a different command, but for some reason you don't want to use
global-set-key like this:
(global-set-key "\M-*" 'whatever)
--
Kevin Rodgers
paul wrote:
> I've nearly pulled out my hair for the following problem;
> I want to translate M-kp-multiply to M-* *BEFORE* the key
> gets bound to its default function (in my case pop-tag-mark).
You must be running emacs without a window system (or under a window
system, but with the -nw command line option). In an xterm on my
platform (i386-pc-solaris2.7, X toolkit), `C-h k M-kp-multiply' shows
| ESC * runs the command pop-tag-mark
and then `C-h l' shows
| C-h k ESC * C-h l
The odd thing is that function-key-map contains this entry
(kp-multiply . [42])
but no escape sequence that maps to [kp-multiply] in the way that `ESC [
1 1 ~' is bound to [f1] or `ESC O p' is bound to [kp-1].
> I do *not* want to use global-set-key but am looking for
> a general way to remap non-ascii input events.
What non-ASCII input event do you think your terminal is sending to
Emacs?
> Using (define-key function-key-map ...) or (define-key key-translation-map ...)
> is too late; I can remap the key, but the function pop-tag-mark is not
> called.
Since setting function-key-map and key-translation-map do not change the
results reported by `C-h k' and `C-h l', I don't think they have
anything to do with it: I think it means that the xterm is actually
sending `*' to Emacs, not an escape sequence.
> Trying an approach with keyboard-translate drives me nuts because
> it does not seem to support non-ascii events.
What do you want to do? It seems like you want to bind M-kp-multiply to
a different command, but for some reason you don't want to use
global-set-key like this:
(global-set-key "\M-*" 'whatever)
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to translate M-kp-multiply to M-* before key is mapped to function?
2004-07-02 16:32 ` Kevin Rodgers
@ 2004-07-04 21:51 ` paul
2004-07-05 8:01 ` paul
2004-07-05 18:05 ` Stefan Monnier
0 siblings, 2 replies; 8+ messages in thread
From: paul @ 2004-07-04 21:51 UTC (permalink / raw)
My problem is, is that kp-multiply is bound to * somewhere down the
line,
but C-kp-multiply, M-kp-multiply and C-M-kp-multiply are not.
I would like C-kp-multiply to act like C-*, M-multiply to act like
M-*,
and C-M-kp-multiply to act like C-M-* (without having to rely on
information
to what functions C-*, M-* and C-M-* are bound).
How to tell keyboard-translate to do just this?
I tried any sequence of char, strings, ints etc. to get
keyboard-translate to do what I want, but the closest I get are errors
which show that my literals are wrong or are interpreted as 'C-k'
(with 'p-multiply' as the trail of the literal) etc.
Kevin Rodgers <ihs_4664@yahoo.com> wrote in message news:<40E58E31.60508@yahoo.com>...
> paul wrote:
> > I've nearly pulled out my hair for the following problem;
> > I want to translate M-kp-multiply to M-* *BEFORE* the key
> > gets bound to its default function (in my case pop-tag-mark).
>
> You must be running emacs without a window system (or under a window
> system, but with the -nw command line option). In an xterm on my
> platform (i386-pc-solaris2.7, X toolkit), `C-h k M-kp-multiply' shows
>
> | ESC * runs the command pop-tag-mark
>
> and then `C-h l' shows
>
> | C-h k ESC * C-h l
>
> The odd thing is that function-key-map contains this entry
>
> (kp-multiply . [42])
>
> but no escape sequence that maps to [kp-multiply] in the way that `ESC [
> 1 1 ~' is bound to [f1] or `ESC O p' is bound to [kp-1].
>
> > I do *not* want to use global-set-key but am looking for
> > a general way to remap non-ascii input events.
>
> What non-ASCII input event do you think your terminal is sending to
> Emacs?
>
> > Using (define-key function-key-map ...) or (define-key key-translation-map ...)
> > is too late; I can remap the key, but the function pop-tag-mark is not
> > called.
>
> Since setting function-key-map and key-translation-map do not change the
> results reported by `C-h k' and `C-h l', I don't think they have
> anything to do with it: I think it means that the xterm is actually
> sending `*' to Emacs, not an escape sequence.
>
> > Trying an approach with keyboard-translate drives me nuts because
> > it does not seem to support non-ascii events.
>
> What do you want to do? It seems like you want to bind M-kp-multiply to
> a different command, but for some reason you don't want to use
> global-set-key like this:
>
> (global-set-key "\M-*" 'whatever)
>
> --
> Kevin Rodgers
> paul wrote:
> > I've nearly pulled out my hair for the following problem;
> > I want to translate M-kp-multiply to M-* *BEFORE* the key
> > gets bound to its default function (in my case pop-tag-mark).
>
> You must be running emacs without a window system (or under a window
> system, but with the -nw command line option). In an xterm on my
> platform (i386-pc-solaris2.7, X toolkit), `C-h k M-kp-multiply' shows
>
> | ESC * runs the command pop-tag-mark
>
> and then `C-h l' shows
>
> | C-h k ESC * C-h l
>
> The odd thing is that function-key-map contains this entry
>
> (kp-multiply . [42])
>
> but no escape sequence that maps to [kp-multiply] in the way that `ESC [
> 1 1 ~' is bound to [f1] or `ESC O p' is bound to [kp-1].
>
> > I do *not* want to use global-set-key but am looking for
> > a general way to remap non-ascii input events.
>
> What non-ASCII input event do you think your terminal is sending to
> Emacs?
>
> > Using (define-key function-key-map ...) or (define-key key-translation-map ...)
> > is too late; I can remap the key, but the function pop-tag-mark is not
> > called.
>
> Since setting function-key-map and key-translation-map do not change the
> results reported by `C-h k' and `C-h l', I don't think they have
> anything to do with it: I think it means that the xterm is actually
> sending `*' to Emacs, not an escape sequence.
>
> > Trying an approach with keyboard-translate drives me nuts because
> > it does not seem to support non-ascii events.
>
> What do you want to do? It seems like you want to bind M-kp-multiply to
> a different command, but for some reason you don't want to use
> global-set-key like this:
>
> (global-set-key "\M-*" 'whatever)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to translate M-kp-multiply to M-* before key is mapped to function?
2004-07-04 21:51 ` paul
@ 2004-07-05 8:01 ` paul
2004-07-05 18:05 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: paul @ 2004-07-05 8:01 UTC (permalink / raw)
litter@graffiti.net (paul) wrote in message news:<bb3e39cd.0407041351.2c99aa97@posting.google.com>...
Maybe I should add this to clarify things a bit; my emacs is
GNU Emacs 21.3.1 (i386-mingw-nt5.0.2195)
and my kp-multiply keys show up in C-h k as:
*, <C-kp-multiply>, <M-kp-multiply> and <C-M-kp-multiply>
and C-h l shows:
C-h k <kp-multiply> C-h k <M-kp-multiply>
C-h k <C-kp-multiply> C-h k <C-M-kp-multiply>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to translate M-kp-multiply to M-* before key is mapped to function?
2004-07-04 21:51 ` paul
2004-07-05 8:01 ` paul
@ 2004-07-05 18:05 ` Stefan Monnier
2004-07-06 9:23 ` paul
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2004-07-05 18:05 UTC (permalink / raw)
> My problem is, is that kp-multiply is bound to * somewhere down the line,
> but C-kp-multiply, M-kp-multiply and C-M-kp-multiply are not. I would
> like C-kp-multiply to act like C-*, M-multiply to act like M-*, and
> C-M-kp-multiply to act like C-M-* (without having to rely on information
> to what functions C-*, M-* and C-M-* are bound).
> How to tell keyboard-translate to do just this?
You need something like
(define-key function-key-map [M-kp-multiply] [?\M-*])
(define-key function-key-map [C-kp-multiply] [?\C-*])
(define-key function-key-map [C-M-kp-multiply] [?\C-\M-*])
I don't think there is an easy way to have all combinations mapped in
a single step. Sadly.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to translate M-kp-multiply to M-* before key is mapped to function?
2004-07-05 18:05 ` Stefan Monnier
@ 2004-07-06 9:23 ` paul
2004-07-07 17:13 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: paul @ 2004-07-06 9:23 UTC (permalink / raw)
Stefan Monnier <monnier@iro.umontreal.ca> wrote in message news:<jwvacyenxga.fsf-monnier+gnu.emacs.help@gnu.org>...
> > My problem is, is that kp-multiply is bound to * somewhere down the line,
> > but C-kp-multiply, M-kp-multiply and C-M-kp-multiply are not. I would
> > like C-kp-multiply to act like C-*, M-multiply to act like M-*, and
> > C-M-kp-multiply to act like C-M-* (without having to rely on information
> > to what functions C-*, M-* and C-M-* are bound).
>
> > How to tell keyboard-translate to do just this?
>
> You need something like
>
> (define-key function-key-map [M-kp-multiply] [?\M-*])
> (define-key function-key-map [C-kp-multiply] [?\C-*])
> (define-key function-key-map [C-M-kp-multiply] [?\C-\M-*])
>
> I don't think there is an easy way to have all combinations mapped in
> a single step. Sadly.
>
>
> Stefan
Hi Stefan,
Thanks for your reply. I don't mind having to do multiple steps for this.
Unfortunately, the solution you propose is the one I tried too.
It doesn't work.
Although it indeed remaps the key unto the correct key, it does *NOT* call
the function bound to that key. This is due to the order in which this
remapping is done, it happens *after* the effects of global-set-key, as
far as I can tell (at least it does for M-*, pop-tag-mark).
Regards,
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to translate M-kp-multiply to M-* before key is mapped to function?
2004-07-06 9:23 ` paul
@ 2004-07-07 17:13 ` Stefan Monnier
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2004-07-07 17:13 UTC (permalink / raw)
> Although it indeed remaps the key unto the correct key, it does *NOT* call
> the function bound to that key. This is due to the order in which this
> remapping is done, it happens *after* the effects of global-set-key, as
> far as I can tell (at least it does for M-*, pop-tag-mark).
No, you are mistaken. The problem you're seeing must be due to
something else. The way it works is:
- if the key is bound in the normal maps, use the binding.
- else if the key has a binding is function-key-map, do the rebinding
and then look up the result in the normal maps.
So one problem may be if you have M-kp-multiply bound to a function
in one of the normal maps (global, of buffer-local), in which case
function-key-map will indeed be ignored.
Another problem might be if M-kp-multiply is not coming directly from the
keyboard but is itself the result of mapping some keyboard's input through
function-key-map, in which case it will not go through function-key-map
again. This can happen e.g. if you run in a text terminal.
You can also try (define-key key-translation-map [M-kp-multiply] [?\M-*])
because key-translation-map does the translation whether there is a normal
binding or not.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-07-07 17:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-02 15:10 How to translate M-kp-multiply to M-* before key is mapped to function? paul
2004-07-02 15:28 ` Kai Grossjohann
2004-07-02 16:32 ` Kevin Rodgers
2004-07-04 21:51 ` paul
2004-07-05 8:01 ` paul
2004-07-05 18:05 ` Stefan Monnier
2004-07-06 9:23 ` paul
2004-07-07 17:13 ` Stefan Monnier
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.