bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10857: ucs-insert deals inconsistently with errors


From: Juri Linkov
Subject: bug#10857: ucs-insert deals inconsistently with errors
Date: Tue, 21 Feb 2012 02:37:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu)

> 1)  M-x ucs-insert <RET> zzz <RET>   => "Not a Unicode character code: nil"
>     Which is caused by `read-char-by-name' not having a way to pass
> back what the user really typed. Still, I typed "zzz", not "nil", so
> the message is unhelpful.

Wouldn't it be too weird for `read-char-by-name' to return "zzz"
when the purpose of this function is to return a character,
not a string the user typed.

> 2) When called from lisp code, it deals differently with erroneous
> strings and erroneous non-strings:
>     (ucs-insert 'zzz)  =>  "Not a Unicode character code: zzz"   ;; correct
>     (ucs-insert "zzz")  =>  any non-hex string is turned into ^@ and
> inserted, and no error is produced.
>
> The second problem can be trivially fixed with
> (not (string-match-p "[^[:xdigit:]]" character)),

In `read-char-by-name', the condition for this purpose is:

  (string-match-p "^[0-9a-fA-F]+$" input)





reply via email to

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