From: Juri Linkov <juri@jurta.org>
To: Miles Bader <miles@gnu.org>
Cc: tzz@lifelogs.com, Kenichi Handa <handa@m17n.org>,
emacs-devel@gnu.org,
David De La Harpe Golden <david@harpegolden.net>
Subject: Re: inputting characters by hexadigit
Date: Sat, 19 Jul 2008 03:27:55 +0300 [thread overview]
Message-ID: <873am6rb8k.fsf@jurta.org> (raw)
In-Reply-To: <buofxq7v02i.fsf@dhapc248.dev.necel.com> (Miles Bader's message of "Fri, 18 Jul 2008 21:39:01 +0900")
> David De La Harpe Golden <david@harpegolden.net> writes:
>>> I once proposed C-q 8 and C-9 to change read-quoted-char-radix to 10
>>> and 16 temporarily so that one can type C-q 9 c 0 RET to input
>>> U+00C0. I still think it's very convenient.
>>
>> Well, convenient, but maybe supporting emacs lisp hex
>> literal syntax might be more memorable? e.g. C-q #x2618
>
> Yes, that sounds like a good syntax to me -- I think it's important that
> it be easy to remember, because many people will use it only
> occasionally.
In pre-23 days I once submitted a patch that used `C-q x00B6' syntax.
But I agree that hash notation is better because it is easy to remember
and consistent with standard Lisp syntax.
The patch below now provides the following variants:
C-q #x2323
C-q #o21443
C-q #b0010001100100011
C-q #d8995
However, I'm not sure about #d8995. It is non-standard syntax where read
fails with (invalid-read-syntax "#"). The standard syntax for decimal is
without hash notation. This suggests using `C-q 8995'. But this means
changing read-quoted-char-radix default to 10!
Anyway, this patch also provides `C-q U2323' syntax that is mnemonic
for everyone accustomed to U+ syntax.
And another convenience is `C-q # RET' where after typing RET it reads a
code point or Unicode name in the minibuffer.
Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.601
diff -c -r1.601 subr.el
*** lisp/subr.el 27 Jun 2008 02:13:36 -0000 1.601
--- lisp/subr.el 19 Jul 2008 00:27:36 -0000
***************
*** 1721,1727 ****
The optional argument PROMPT specifies a string to use to prompt the user.
The variable `read-quoted-char-radix' controls which radix to use
for numeric input."
! (let ((message-log-max nil) done (first t) (code 0) char translated)
(while (not done)
(let ((inhibit-quit first)
;; Don't let C-h get the help message--only help function keys.
--- 1721,1728 ----
The optional argument PROMPT specifies a string to use to prompt the user.
The variable `read-quoted-char-radix' controls which radix to use
for numeric input."
! (let ((message-log-max nil) done (first t) (code 0) char translated
! (radix read-quoted-char-radix) hash)
(while (not done)
(let ((inhibit-quit first)
;; Don't let C-h get the help message--only help function keys.
***************
*** 1753,1765 ****
;; Turn a meta-character into a character with the 0200 bit set.
(setq code (logior (logand translated (lognot ?\M-\^@)) 128)
done t))
! ((and (<= ?0 translated) (< translated (+ ?0 (min 10 read-quoted-char-radix))))
! (setq code (+ (* code read-quoted-char-radix) (- translated ?0)))
(and prompt (setq prompt (message "%s %c" prompt translated))))
((and (<= ?a (downcase translated))
! (< (downcase translated) (+ ?a -10 (min 36 read-quoted-char-radix))))
! (setq code (+ (* code read-quoted-char-radix)
! (+ 10 (- (downcase translated) ?a))))
(and prompt (setq prompt (message "%s %c" prompt translated))))
((and (not first) (eq translated ?\C-m))
(setq done t))
--- 1754,1789 ----
;; Turn a meta-character into a character with the 0200 bit set.
(setq code (logior (logand translated (lognot ?\M-\^@)) 128)
done t))
! ((and first (= ?u (downcase translated)))
! (setq radix 16)
! (and prompt (setq prompt (message "%s U+" prompt))))
! ((and first (= ?# translated))
! (setq hash t)
! (and prompt (setq prompt (message "%s #" prompt))))
! (hash
! (cond
! ((= ?d (downcase translated))
! (setq radix 10)
! (and prompt (setq prompt (message "%s D" prompt))))
! ((= ?b (downcase translated))
! (setq radix 2)
! (and prompt (setq prompt (message "%s B" prompt))))
! ((= ?o (downcase translated))
! (setq radix 8)
! (and prompt (setq prompt (message "%s O" prompt))))
! ((= ?x (downcase translated))
! (setq radix 16)
! (and prompt (setq prompt (message "%s X" prompt))))
! ((= ?\015 (downcase translated))
! (setq done t code (read-char-by-name "Unicode (hex or name): "))
! (and prompt (setq prompt (message "%s X" prompt)))))
! (setq hash nil))
! ((and (<= ?0 translated) (< translated (+ ?0 (min 10 radix))))
! (setq code (+ (* code radix) (- translated ?0)))
(and prompt (setq prompt (message "%s %c" prompt translated))))
((and (<= ?a (downcase translated))
! (< (downcase translated) (+ ?a -10 (min 36 radix))))
! (setq code (+ (* code radix) (+ 10 (- (downcase translated) ?a))))
(and prompt (setq prompt (message "%s %c" prompt translated))))
((and (not first) (eq translated ?\C-m))
(setq done t))
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2008-07-19 0:27 UTC|newest]
Thread overview: 160+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-15 17:41 describe-char should display the character's Unicode name Ted Zlatanov
2008-07-15 20:42 ` Juri Linkov
2008-07-16 2:29 ` Kenichi Handa
2008-07-17 0:35 ` Juri Linkov
2008-07-17 1:26 ` Kenichi Handa
2008-07-17 14:09 ` Ted Zlatanov
2008-07-17 23:40 ` Juri Linkov
2008-07-18 0:10 ` Miles Bader
2008-07-18 0:47 ` inputting characters by hexadigit Kenichi Handa
2008-07-18 0:54 ` Lennart Borgman (gmail)
2008-07-18 1:01 ` Miles Bader
2008-07-18 4:48 ` David De La Harpe Golden
2008-07-18 12:39 ` Miles Bader
2008-07-18 16:17 ` Stephen J. Turnbull
2008-07-18 17:33 ` David De La Harpe Golden
2008-07-18 18:08 ` James Cloos
2008-07-18 18:59 ` Stephen J. Turnbull
2008-07-18 21:29 ` James Cloos
2008-07-19 0:30 ` Juri Linkov
2008-07-21 1:41 ` Stefan Monnier
2008-07-21 5:35 ` David De La Harpe Golden
2008-07-22 22:59 ` Juri Linkov
2008-07-22 23:17 ` Lennart Borgman (gmail)
2008-07-22 23:29 ` David De La Harpe Golden
2008-07-29 16:07 ` Juri Linkov
2008-07-29 18:00 ` Stefan Monnier
2008-07-19 5:49 ` Stephen J. Turnbull
2008-07-19 0:13 ` Miles Bader
2008-07-19 0:29 ` Juri Linkov
2008-07-19 0:27 ` Juri Linkov [this message]
2008-07-20 20:28 ` Juri Linkov
2008-07-21 1:46 ` Stefan Monnier
2008-07-21 5:07 ` David De La Harpe Golden
2008-07-21 6:04 ` Stefan Monnier
2008-07-21 9:01 ` Juri Linkov
2008-07-21 11:04 ` Johan Bockgård
2008-07-21 11:11 ` David Kastrup
2008-07-21 14:20 ` Johan Bockgård
2008-07-21 14:24 ` David Kastrup
2008-07-21 14:33 ` Lennart Borgman (gmail)
2008-07-21 14:37 ` David Kastrup
2008-07-21 19:25 ` James Cloos
2008-07-21 19:53 ` Stefan Monnier
2008-07-21 20:23 ` Miles Bader
2008-07-21 20:38 ` Lennart Borgman (gmail)
2008-07-21 21:49 ` Johan Bockgård
2008-07-21 22:03 ` David Kastrup
2008-07-21 23:37 ` Johan Bockgård
2008-07-22 1:26 ` David De La Harpe Golden
2008-07-22 22:52 ` Juri Linkov
2008-07-21 20:31 ` David Kastrup
2008-07-21 20:36 ` David De La Harpe Golden
2008-07-21 20:43 ` David Kastrup
2008-07-21 20:50 ` Lennart Borgman (gmail)
2008-07-21 21:12 ` David Kastrup
2008-07-21 21:03 ` Alfred M. Szmidt
2008-07-21 21:24 ` Drew Adams
2008-07-22 4:03 ` Miles Bader
2008-07-21 21:06 ` David De La Harpe Golden
2008-07-22 4:04 ` Miles Bader
2008-07-21 20:31 ` James Cloos
2008-07-21 21:11 ` David De La Harpe Golden
2008-07-21 23:43 ` Juri Linkov
2008-07-22 4:06 ` Miles Bader
2008-07-21 16:54 ` David De La Harpe Golden
2008-07-21 17:04 ` David De La Harpe Golden
2008-07-21 6:16 ` David Kastrup
2008-07-22 0:51 ` Kenichi Handa
2008-07-22 7:56 ` Juanma Barranquero
2008-07-22 8:33 ` Miles Bader
2008-07-22 10:57 ` Juanma Barranquero
2008-07-22 12:26 ` Kenichi Handa
2008-07-22 12:33 ` Lennart Borgman (gmail)
2008-07-22 12:35 ` Miles Bader
2008-07-22 16:16 ` Stefan Monnier
2008-07-22 16:54 ` Drew Adams
2008-07-22 20:38 ` Alfred M. Szmidt
2008-07-22 22:55 ` Juri Linkov
2008-07-23 0:08 ` David De La Harpe Golden
2008-07-23 2:18 ` Miles Bader
2008-07-22 22:54 ` Juri Linkov
2008-07-23 0:28 ` Miles Bader
2008-07-23 1:02 ` Kenichi Handa
2008-07-23 2:32 ` Stefan Monnier
2008-07-23 3:18 ` Miles Bader
2008-07-23 3:38 ` David De La Harpe Golden
2008-07-23 3:53 ` Stefan Monnier
2008-07-23 4:26 ` David De La Harpe Golden
2008-07-23 19:19 ` Stefan Monnier
2008-07-23 20:26 ` David De La Harpe Golden
2008-07-23 9:03 ` Juri Linkov
2008-07-23 10:15 ` Miles Bader
2008-07-23 14:27 ` Juri Linkov
2008-07-23 14:58 ` Miles Bader
2008-07-22 14:06 ` Drew Adams
2008-07-23 13:01 ` Ted Zlatanov
2008-07-23 13:05 ` Lennart Borgman (gmail)
2008-07-23 13:44 ` Drew Adams
2008-07-23 14:27 ` Juri Linkov
2008-07-23 19:24 ` Stefan Monnier
2008-07-23 22:32 ` Juri Linkov
2008-07-24 2:05 ` Stefan Monnier
2008-07-29 15:51 ` Juri Linkov
2008-07-29 17:33 ` Chong Yidong
2008-07-29 17:51 ` Juri Linkov
2008-07-29 19:55 ` Stefan Monnier
2008-07-29 20:51 ` Chong Yidong
2008-07-30 15:29 ` Juri Linkov
2008-07-31 19:20 ` Ted Zlatanov
2008-07-18 0:38 ` describe-char should display the character's Unicode name Kenichi Handa
2008-07-18 0:58 ` Miles Bader
2008-07-18 13:33 ` Ted Zlatanov
2008-07-18 13:53 ` Drew Adams
2008-07-18 14:31 ` Stefan Monnier
2008-07-18 15:22 ` Ted Zlatanov
2008-07-19 0:45 ` Juri Linkov
2008-07-21 16:35 ` Ted Zlatanov
2008-07-21 16:35 ` Lennart Borgman (gmail)
2008-07-21 16:58 ` David De La Harpe Golden
2008-07-22 22:57 ` Juri Linkov
2008-07-23 14:47 ` Ted Zlatanov
2008-07-23 22:31 ` Juri Linkov
2008-07-23 22:52 ` Lennart Borgman (gmail)
2008-07-24 13:29 ` Ted Zlatanov
2008-07-24 13:39 ` Lennart Borgman
2008-07-24 15:27 ` Ted Zlatanov
2008-07-24 15:34 ` Lennart Borgman (gmail)
2008-07-25 0:41 ` Juri Linkov
2008-07-25 2:24 ` Kenichi Handa
2008-07-19 0:35 ` Juri Linkov
2008-07-19 1:11 ` Kenichi Handa
2008-07-20 0:29 ` inputting characters by hexadigit Juri Linkov
2008-07-20 1:23 ` Kenichi Handa
2008-07-20 20:27 ` Juri Linkov
2008-07-23 14:37 ` Ted Zlatanov
2008-07-23 19:31 ` Stefan Monnier
2008-07-23 20:19 ` Ted Zlatanov
2008-07-24 2:08 ` Stefan Monnier
2008-07-24 13:20 ` Ted Zlatanov
2008-07-24 13:40 ` Lennart Borgman
2008-07-24 14:03 ` Stefan Monnier
2008-07-24 15:25 ` Ted Zlatanov
2008-07-24 16:06 ` Stefan Monnier
2008-07-24 17:00 ` Drew Adams
2008-07-24 18:15 ` Ted Zlatanov
2008-07-24 18:37 ` Drew Adams
2008-07-28 13:56 ` Ted Zlatanov
2008-07-24 20:12 ` Stefan Monnier
2008-07-24 20:27 ` Drew Adams
2008-07-24 20:37 ` Lennart Borgman (gmail)
2008-07-24 21:30 ` Lennart Borgman (gmail)
2008-07-24 21:59 ` Lennart Borgman (gmail)
2008-07-28 14:00 ` Ted Zlatanov
2008-07-23 22:35 ` Juri Linkov
2008-07-23 23:00 ` Lennart Borgman (gmail)
2008-07-24 2:18 ` Stefan Monnier
2008-07-25 0:52 ` Juri Linkov
2008-07-24 13:24 ` Ted Zlatanov
2008-07-24 15:55 ` Drew Adams
2008-07-19 0:35 ` describe-char should display the character's Unicode name Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873am6rb8k.fsf@jurta.org \
--to=juri@jurta.org \
--cc=david@harpegolden.net \
--cc=emacs-devel@gnu.org \
--cc=handa@m17n.org \
--cc=miles@gnu.org \
--cc=tzz@lifelogs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.