unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to get Meta+y to be Meta+Tab
@ 2008-10-24 21:47 Xah
  2008-10-24 23:08 ` B. T. Raven
  2008-10-25 23:01 ` Andreas Politz
  0 siblings, 2 replies; 6+ messages in thread
From: Xah @ 2008-10-24 21:47 UTC (permalink / raw)
  To: help-gnu-emacs

suppose i want to make Meta+y to function as pressing Meta+Tab.

intuitively, i do this:
(keyboard-translate ?\M-y ?\M-9) ; Meta+y to Meta+Tab

but that does not work.

i looked in the elisp doc... seems the issue is rather complex
involving elisp reader for chars under data type chapter, Event Mod
under Input Events chapter, Keymap translation under key map
chapter... hard to have a coherent picture at this point.

Any idea how to get this to work?

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to get Meta+y to be Meta+Tab
  2008-10-24 21:47 how to get Meta+y to be Meta+Tab Xah
@ 2008-10-24 23:08 ` B. T. Raven
  2008-10-25 21:40   ` Xah
  2008-10-25 23:01 ` Andreas Politz
  1 sibling, 1 reply; 6+ messages in thread
From: B. T. Raven @ 2008-10-24 23:08 UTC (permalink / raw)
  To: help-gnu-emacs

Xah wrote:
> suppose i want to make Meta+y to function as pressing Meta+Tab.
> 
> intuitively, i do this:
> (keyboard-translate ?\M-y ?\M-9) ; Meta+y to Meta+Tab
> 
> but that does not work.
> 
> i looked in the elisp doc... seems the issue is rather complex
> involving elisp reader for chars under data type chapter, Event Mod
> under Input Events chapter, Keymap translation under key map
> chapter... hard to have a coherent picture at this point.
> 
> Any idea how to get this to work?
> 
>   Xah
> ∑ http://xahlee.org/
> 
> ☄

Maybe (global-unset-key KEY)and then (global-set-key)? Some minor modes 
might override the new setting but probably most won't.

Ed
Btw, what is that shooting star symbol? What unicode code point?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to get Meta+y to be Meta+Tab
  2008-10-24 23:08 ` B. T. Raven
@ 2008-10-25 21:40   ` Xah
  2008-10-26 14:11     ` Nikolaj Schumacher
       [not found]     ` <mailman.2123.1225030309.25473.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Xah @ 2008-10-25 21:40 UTC (permalink / raw)
  To: help-gnu-emacs

Xah wrote:
«suppose i want to make Meta+y to function as pressing Meta+Tab.
intuitively, i do this: (keyboard-translate ?\M-y ?\M-9) but that does
not work.»

B T Raven wrote:
«Maybe (global-unset-key KEY)and then (global-set-key)? Some minor
modes might override the new setting but probably most won't.»

am pretty sure that global-set-key cannot be used for the
functionality of keyboard-translate.

«Btw, what is that shooting star symbol? What unicode code point?»

      character: ☄ (299364, #o1110544, #x49164, U+2604)
           Name: COMET

you might want to install the unicode data file so these info and more
is available to what-cursor-position (Ctrl+u Ctrl+=). (I append the
char to end of my sig to force web-based forums to use unicode for
encoding.)

See:
http://xahlee.org/emacs/emacs_n_unicode.html

quote:

Q: I have this character α on the screen. How to find out its
unicode's hex value or name?

You can find out a character's decimal, octal, or hex values by
placing your cursor on the character, and type “Alt+x what-cursor-
position” (Ctrl+x =). You can get more info if you place your cursor
on the character, then press “Ctrl+u Ctrl+x =”.

However, if you want the complete unicode info of a character, you
need to download a unicode data file and let emacs know where it is.
The unicode data file can be downloaded at: http://www.unicode.org/Public/UNIDATA/UnicodeData.txt.
After you downloaded it, place the following code in your “~/.emacs”
to let emacs know where it is:

; set unicode data file location. (used by what-cursor-position)
(let ((x "~/Documents/emacs/UnicodeData.txt"))
  (when (file-exists-p x)
    (setq describe-char-unicodedata-file x)))

Then restart emacs. Once you've done this, then place your cursor on a
unicode char, and do “Ctrl+u Ctrl+x =”, then emacs will give you all
the unicode info about that char, including the code point in decimal,
octal, hex notations, as well the unicode character name, category,
the font emacs is using, and others.

For example, here's the output on the character “α”:

      character: α (332721, #o1211661, #x513b1, U+03B1)
        charset: mule-unicode-0100-24ff
                 (Unicode characters of the range U+0100..U+24FF.)
     code point: #x27 #x31
         syntax: w 	which means: word
       category: g:Greek
    buffer code: #x9C #xF4 #xA7 #xB1
      file code: #xCE #xB1 (encoded by coding system mule-utf-8-unix)
        display: by this font (glyph code)
     -apple-symbol-medium-r-normal--14-140-72-72-m-140-mac-symbol
(#x61)
   Unicode data:
           Name: GREEK SMALL LETTER ALPHA
       Category: lowercase letter
Combining class: Spacing
  Bidi category: Left-to-Right
      Uppercase: Α
      Titlecase: Α

There are text properties here:
  fontified            t

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to get Meta+y to be Meta+Tab
  2008-10-24 21:47 how to get Meta+y to be Meta+Tab Xah
  2008-10-24 23:08 ` B. T. Raven
@ 2008-10-25 23:01 ` Andreas Politz
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Politz @ 2008-10-25 23:01 UTC (permalink / raw)
  To: help-gnu-emacs

Xah wrote:
> suppose i want to make Meta+y to function as pressing Meta+Tab.
> 
> intuitively, i do this:
> (keyboard-translate ?\M-y ?\M-9) ; Meta+y to Meta+Tab
> 
> but that does not work.
> 
> i looked in the elisp doc... seems the issue is rather complex
> involving elisp reader for chars under data type chapter, Event Mod
> under Input Events chapter, Keymap translation under key map
> chapter... hard to have a coherent picture at this point.
> 
> Any idea how to get this to work?
> 
>   Xah
> ∑ http://xahlee.org/
> 
> ☄

?\M-9 is the metafied key left from the 0 key. Anyway keyboard-translate
does not work with meta, try key-translation-map

(define-key key-translation-map [?\M-y] [?\M-\C-i])

-ap


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to get Meta+y to be Meta+Tab
  2008-10-25 21:40   ` Xah
@ 2008-10-26 14:11     ` Nikolaj Schumacher
       [not found]     ` <mailman.2123.1225030309.25473.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Nikolaj Schumacher @ 2008-10-26 14:11 UTC (permalink / raw)
  To: Xah; +Cc: help-gnu-emacs

Xah <xahlee@gmail.com> wrote:

> Xah wrote:
> «suppose i want to make Meta+y to function as pressing Meta+Tab.
> intuitively, i do this: (keyboard-translate ?\M-y ?\M-9) but that does
> not work.»
>
> B T Raven wrote:
> «Maybe (global-unset-key KEY)and then (global-set-key)? Some minor
> modes might override the new setting but probably most won't.»

It would be nice if you could use a more common quoting mechanism (like
a ">" prefix), so syntax highlighting picks up the quotation.  It makes
reading much easier.

> am pretty sure that global-set-key cannot be used for the
> functionality of keyboard-translate.

In a way it can.  You can bind it to a macro:

(global-set-key "\M-y" "\M-\t")

Using `keyboard-translate' is generally a little risky, because it will
change the key in all places.  So people wouldn't be able to do use C-c M-y
anymore.  So I would only use it to fix keyboard issues.

You can also write a function like this:

(defun do-what-backspace-does ()
  (interactive)
  (call-interactively (key-binding "\C-?")))

I've found that one to be the most reliable solution.


regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to get Meta+y to be Meta+Tab
       [not found]     ` <mailman.2123.1225030309.25473.help-gnu-emacs@gnu.org>
@ 2008-10-28  6:13       ` Xah
  0 siblings, 0 replies; 6+ messages in thread
From: Xah @ 2008-10-28  6:13 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 26, 7:11 am, Nikolaj Schumacher <m...@nschum.de> wrote:
> Xah<xah...@gmail.com> wrote:
> > am pretty sure that global-set-key cannot be used for the
> > functionality of keyboard-translate.
>
> In a way it can.  You can bind it to a macro:
>
> (global-set-key "\M-y" "\M-\t")

Super. Thanks.

seems this still does not work well... For example, after i did that,
then in a text mode i have cursor at the end of “m” in “this form
that”. Then, pressing Alt+y gives me this error:

«After 0 kbd macro iterations: ispell-command-loop: Keyboard macro
terminated by a command ringing the bell»

but pressing Esc Tab does return a list of completion.

what i'm trying to do is to get command completion to some Meta
+‹letter› binding, because Alt+Tab is used by the OS to switch apps.
So, in the past 10 years i just used Esc Tab but that's 2
keystrokes...

The normal way of binding M-‹letter› to a command wont work well
because the command name varies depending on the mode. e.g. ispell-
complete-word, lisp-complete-word, etc.

> Using `keyboard-translate' is generally a little risky, because it will
> change the key in all places.  So people wouldn't be able to do use C-c M-y
> anymore.  So I would only use it to fix keyboard issues.

great advice.

> You can also write a function like this:
>
> (defun do-what-backspace-does ()
>   (interactive)
>   (call-interactively (key-binding "\C-?")))
>
> I've found that one to be the most reliable solution.

This won't work for my need above... but will try it out for other
uses. Thanks.

Andreas Politz wrote::
> (define-key key-translation-map [?\M-y] [?\M-\C-i])

this seems to work. Thanks.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-28  6:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24 21:47 how to get Meta+y to be Meta+Tab Xah
2008-10-24 23:08 ` B. T. Raven
2008-10-25 21:40   ` Xah
2008-10-26 14:11     ` Nikolaj Schumacher
     [not found]     ` <mailman.2123.1225030309.25473.help-gnu-emacs@gnu.org>
2008-10-28  6:13       ` Xah
2008-10-25 23:01 ` Andreas Politz

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).