From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#10857: ucs-insert deals inconsistently with errors Date: Wed, 22 Feb 2012 02:09:20 +0200 Organization: JURTA Message-ID: <87ehtnwwy7.fsf@mail.jurta.org> References: <87obstt2n9.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1329869512 10779 80.91.229.3 (22 Feb 2012 00:11:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 22 Feb 2012 00:11:52 +0000 (UTC) Cc: 10857@debbugs.gnu.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 22 01:11:51 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RzzoE-0002aa-KO for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Feb 2012 01:11:50 +0100 Original-Received: from localhost ([::1]:45407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RzzoD-0005Ae-2h for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Feb 2012 19:11:49 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rzzo9-0005AV-VO for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2012 19:11:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rzzo7-0008VW-Nf for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2012 19:11:45 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45800) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rzzo7-0008VG-J6 for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2012 19:11:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RzzqM-0001Rt-Bl for bug-gnu-emacs@gnu.org; Tue, 21 Feb 2012 19:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Feb 2012 00:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10857 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10857-submit@debbugs.gnu.org id=B10857.13298696375547 (code B ref 10857); Wed, 22 Feb 2012 00:14:02 +0000 Original-Received: (at 10857) by debbugs.gnu.org; 22 Feb 2012 00:13:57 +0000 Original-Received: from localhost ([127.0.0.1]:49421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RzzqH-0001RO-H1 for submit@debbugs.gnu.org; Tue, 21 Feb 2012 19:13:57 -0500 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:44830 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RzzqE-0001RD-KF; Tue, 21 Feb 2012 19:13:55 -0500 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 22169451C749; Tue, 21 Feb 2012 16:09:59 -0800 (PST) In-Reply-To: (Juanma Barranquero's message of "Tue, 21 Feb 2012 02:25:47 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57057 Archived-At: tags 10857 patch thanks > Yes. I don't think `read-char-by-name' should return "zzz", I think > `ucs-insert' should not say the "nil" part. Perhaps just "Not a > Unicode character". > >> In `read-char-by-name', the condition for this purpose is: >> >> =A0(string-match-p "^[0-9a-fA-F]+$" input) > > They are equivalent, aren't they? But my point was that the docstring > does not say what to expect in CHARACTER. This should be fixed by this patch: =3D=3D=3D modified file 'lisp/international/mule-cmds.el' --- lisp/international/mule-cmds.el 2012-02-10 19:35:28 +0000 +++ lisp/international/mule-cmds.el 2012-02-22 00:07:34 +0000 @@ -2949,7 +2949,7 @@ (defun read-char-by-name (prompt) '(metadata (category . unicode-name)) (complete-with-action action (ucs-names) string pre= d)))))) (cond - ((string-match-p "^[0-9a-fA-F]+$" input) + ((string-match-p "\\`[0-9a-fA-F]+\\'" input) (string-to-number input 16)) ((string-match-p "^#" input) (read input)) @@ -2967,6 +2967,10 @@ (defun ucs-insert (character &optional c the characters whose names include that substring, not necessarily at the beginning of the name. =20 +This function also accepts a hexadecimal number of Unicode code +point or a number in hash notation, e.g. #o21430 for octal, +#x2318 for hex, or #10r8984 for decimal. + The optional third arg INHERIT (non-nil when called interactively), says to inherit text properties from adjoining text, if those properties are sticky." @@ -2975,9 +2979,12 @@ (defun ucs-insert (character &optional c (prefix-numeric-value current-prefix-arg) t)) (unless count (setq count 1)) - (if (stringp character) + (if (and (stringp character) + (string-match-p "\\`[0-9a-fA-F]+\\'" character)) (setq character (string-to-number character 16))) (cond + ((null character) + (error "Not a Unicode character")) ((not (integerp character)) (error "Not a Unicode character code: %S" character)) ((or (< character 0) (> character #x10FFFF))