[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: Alt+numpad to write special symbols
From: |
MON KEY |
Subject: |
Re: Fwd: Alt+numpad to write special symbols |
Date: |
Tue, 29 Sep 2009 21:40:41 -0400 |
> 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
- Re: Fwd: Alt+numpad to write special symbols,
MON KEY <=