all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Alt+numpad to write special symbols
@ 2009-09-29  0:49 David Capello
  2009-09-29  0:57 ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: David Capello @ 2009-09-29  0:49 UTC (permalink / raw
  To: emacs-devel

Is there a way to use Alt+numpad to write Unicode
characters in Emacs? Or does it need a patch?
Have someone tried it before?

If there are not a way to pass Alt+numpad keys to OS directly,
I could write a patch for w32. Is someone interested too? Some
suggestion to do this? (maybe a name for a global variable to
customize this behavior, like w32-ignore-alt-numpad, etc.)

Sorry if this mailing list is not the right place to ask this.

More info:
http://en.wikipedia.org/wiki/Windows_Alt_Keycodes




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

* Re: Alt+numpad to write special symbols
  2009-09-29  0:49 Alt+numpad to write special symbols David Capello
@ 2009-09-29  0:57 ` Juanma Barranquero
       [not found]   ` <77b6ce390909281815j1600f85by5837ca2bb4b1f7d@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2009-09-29  0:57 UTC (permalink / raw
  To: David Capello; +Cc: emacs-devel

On Tue, Sep 29, 2009 at 02:49, David Capello <davidcapello@gmail.com> wrote:

> Is there a way to use Alt+numpad to write Unicode
> characters in Emacs? Or does it need a patch?
> Have someone tried it before?

Why do you want to use Alt+numpad? You can already type an Unicode
codepoint with `ucs-insert' (bound to C-x 8 RET).

    Juanma




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

* Fwd: Alt+numpad to write special symbols
       [not found]   ` <77b6ce390909281815j1600f85by5837ca2bb4b1f7d@mail.gmail.com>
@ 2009-09-29  1:27     ` David Capello
  2009-09-29  3:13       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: David Capello @ 2009-09-29  1:27 UTC (permalink / raw
  To: emacs-devel

---------- Forwarded message ----------
From: David Capello <davidcapello@gmail.com>
Date: Mon, Sep 28, 2009 at 10:15 PM
Subject: Re: Alt+numpad to write special symbols
To: Juanma Barranquero <lekktu@gmail.com>


On Mon, Sep 28, 2009 at 9:57 PM, Juanma Barranquero <lekktu@gmail.com> wrote:
> On Tue, Sep 29, 2009 at 02:49, David Capello <davidcapello@gmail.com> wrote:
>> Is there a way to use Alt+numpad to write Unicode
>> characters in Emacs? Or does it need a patch?
>> Have someone tried it before?
>
> Why do you want to use Alt+numpad?

It's a long history, but basically because in all other programs
you can use Alt+numpad.

> You can already type an Unicode
> codepoint with `ucs-insert' (bound to C-x 8 RET).

Thanks about that. I did not know about ucs-insert, but
still I need Alt+numpad behavior.

Another thing: I think it is impossible to emulate
the Alt+keypad just with elisp code because I need
to catch something like "Alt-unpressed" event.




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

* Re: Fwd: Alt+numpad to write special symbols
  2009-09-29  1:27     ` Fwd: " David Capello
@ 2009-09-29  3:13       ` Stefan Monnier
  2009-09-29 23:12         ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2009-09-29  3:13 UTC (permalink / raw
  To: David Capello; +Cc: emacs-devel

> Another thing: I think it is impossible to emulate
> the Alt+keypad just with elisp code because I need
> to catch something like "Alt-unpressed" event.

If you mean that "the alt-numpad" feature works by recognizing the
"alt-unpressed" event as the sign that you've finished entering the
number, then indeed, it can't be done in Elisp right now and would
require changes to provide access to the up/down events for key presses
(I actually did code up such a change at some point in the past, to
play with it: it might be doable without introducing too many problems).


        Stefan




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

* Re: Fwd: Alt+numpad to write special symbols
  2009-09-29  3:13       ` Stefan Monnier
@ 2009-09-29 23:12         ` Juri Linkov
  0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2009-09-29 23:12 UTC (permalink / raw
  To: Stefan Monnier; +Cc: David Capello, emacs-devel

>> Another thing: I think it is impossible to emulate
>> the Alt+keypad just with elisp code because I need
>> to catch something like "Alt-unpressed" event.
>
> If you mean that "the alt-numpad" feature works by recognizing the
> "alt-unpressed" event as the sign that you've finished entering the
> number, then indeed, it can't be done in Elisp right now and would
> require changes to provide access to the up/down events for key presses
> (I actually did code up such a change at some point in the past, to
> play with it: it might be doable without introducing too many problems).

Like in GTK+ `Ctrl+Shift+U hex RET' http://en.wikipedia.org/wiki/Unicode_input
we could finish entering the number with RET, e.g. `M-2 M-7 M-0 M-f RET'.
Or expect a fixed-length four-digit number `M-2 M-7 M-0 M-f' where the last
fourth digit finishes the sequence.  In any case, your up/down events code
would be useful for other purposes as well.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: Fwd: Alt+numpad to write special symbols
@ 2009-09-30  1:40 MON KEY
  0 siblings, 0 replies; 6+ messages in thread
From: MON KEY @ 2009-09-30  1:40 UTC (permalink / raw
  To: juri; +Cc: emacs-devel

> Like in GTK+ `Ctrl+Shift+U hex RET' http://en.wikipedia.org/wiki/Unicode_input
> we could finish entering the number with RET, e.g. `M-2 M-7 M-0 M-f RET'.
> Or expect a fixed-length four-digit number `M-2 M-7 M-0 M-f' where the last
> fourth digit finishes the sequence.  In any case, your up/down events code
> would be useful for other purposes as well.

If I understand correctly what the goal is re: hex input and Unicode,
following was written to accomplish just such task:

(defun mon-test-keypresses (&optional first second third)
  "Used to test if additional optional args have been passed to interactive.\n
EXAMPLE:\nM-34 M-x mon-test-keypresses\n
=> \(\(meta . 51\) \(meta . 52\) \(meta . 120\) mon-test-keypresses\)\n►►►"
  (interactive "P\nP\np")
  (let ((accum-string '())
	(accum-event '())
	(self 'mon-test-keypresses))
    (mapc (lambda (x)
            (cond ((= x 13) nil)
                  ((or (eql (car (event-modifiers x)) 'meta)
                       (eql (car (event-modifiers x)) 'control))
                   (setq accum-event (cons (cons (car (event-modifiers
x)) (event-basic-type x)) accum-event)))
                  (t (setq accum-string (cons (char-to-string
(event-basic-type x)) accum-string)))))
          (this-command-keys-vector))
    (setq accum-event (reverse accum-event))
    (setq accum-string (reverse accum-string))
    (setq accum-string (apply 'concat accum-string))
    (setq accum-string `(,@accum-event ,(if (string= accum-string
self) self accum-string)))
        (prin1 accum-string)))

s_P




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

end of thread, other threads:[~2009-09-30  1:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29  0:49 Alt+numpad to write special symbols David Capello
2009-09-29  0:57 ` Juanma Barranquero
     [not found]   ` <77b6ce390909281815j1600f85by5837ca2bb4b1f7d@mail.gmail.com>
2009-09-29  1:27     ` Fwd: " David Capello
2009-09-29  3:13       ` Stefan Monnier
2009-09-29 23:12         ` Juri Linkov
  -- strict thread matches above, loose matches on Subject: below --
2009-09-30  1:40 MON KEY

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.