emacs-devel
[Top][All Lists]
Advanced

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

Re: inputting characters by hexadigit


From: Miles Bader
Subject: Re: inputting characters by hexadigit
Date: Wed, 23 Jul 2008 19:15:28 +0900

Juri Linkov <address@hidden> writes:
> 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...]

-Miles

-- 
Somebody has to do something, and it's just incredibly pathetic that it
has to be us.  -- Jerry Garcia




reply via email to

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