[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inputting characters by hexadigit

From: Juri Linkov
Subject: Re: inputting characters by hexadigit
Date: Wed, 23 Jul 2008 17:27:09 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>> Another drawback (that C-q currently has too) is an inability to edit
>> incomplete input.  This pushes us back to the era of dumb calculators
>> without the backspace key.
>> A more convenient method is to use the minibuffer to input the number.
> We could have C-x 8 <DIGIT> prompt using the minibuffer,
> with <DIGIT> pre-stuffed into it...
>    (defun read-and-insert-numeric-char (initial-input)
>      (interactive (list (string last-command-char)))
>      (insert 
>       (string-to-number 
>        (read-from-minibuffer "Character code (hex): " initial-input)
>        16)))
>    (dolist (ch '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?a ?b ?c ?d ?e ?f))
>      (global-set-key (vector ?\C-x ?8 ch) 'read-and-insert-numeric-char))
> [This is not entirely correct, since I'm not sure where the C-x 8 keymap
> is located, so I'm just using the global map...]

Such complexity has a tendency to cause a pain in the buffer.

Juri Linkov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]