From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: describe-char should display the character's Unicode name Date: Sat, 19 Jul 2008 03:35:45 +0300 Organization: JURTA Message-ID: <873am6n21q.fsf@jurta.org> References: <868ww3vydn.fsf@lifelogs.com> <87myki6fqp.fsf@jurta.org> <87mykhz6tf.fsf@jurta.org> <87tzeokrku.fsf@jurta.org> <87od4wgg8p.fsf@catnip.gol.com> <86od4vmi5i.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1216428534 21264 80.91.229.12 (19 Jul 2008 00:48:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Jul 2008 00:48:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: Ted Zlatanov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 19 02:49:41 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KK0dm-0007UL-1g for ged-emacs-devel@m.gmane.org; Sat, 19 Jul 2008 02:49:38 +0200 Original-Received: from localhost ([127.0.0.1]:34999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KK0ct-0001F9-9M for ged-emacs-devel@m.gmane.org; Fri, 18 Jul 2008 20:48:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KK0bi-0000fh-9K for emacs-devel@gnu.org; Fri, 18 Jul 2008 20:47:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KK0bg-0000dY-AD for emacs-devel@gnu.org; Fri, 18 Jul 2008 20:47:29 -0400 Original-Received: from [199.232.76.173] (port=36607 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KK0bg-0000dL-5S for emacs-devel@gnu.org; Fri, 18 Jul 2008 20:47:28 -0400 Original-Received: from relay01.kiev.sovam.com ([62.64.120.200]:2989) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KK0bf-0005E3-Jj for emacs-devel@gnu.org; Fri, 18 Jul 2008 20:47:27 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay01.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1KK0aM-000Lou-63; Sat, 19 Jul 2008 03:47:21 +0300 In-Reply-To: <86od4vmi5i.fsf@lifelogs.com> (Ted Zlatanov's message of "Fri, 18 Jul 2008 08:33:13 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 3b10ce253585130f5293a5b36593fd37 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Trusted X-SpamTest-Info: Profiles 4362 [July 19 2008] X-SpamTest-Info: {received from trusted relay: common white list} X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: white ip list X-SpamTest-Rate: 10 X-SpamTest-Status: Trusted X-SpamTest-Status-Extended: trusted X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.8-5.1 (or MacOS X 10.2-10.3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:100966 Archived-At: > MB> An input method is not a good solution because while input methods are > MB> good for heavy use, they're quite annoying to juggle for occasional inputs. > > Agreed, there should be a function that gives all the Unicode characters > as input candidates and the user can select the one he wants quickly (I > don't see one currently). An input method wouldn't provide completion > candidates, so the user has to remember all the names he needs. > > Would a few thousand candidates be a problem for completion? I've only > seen it with hundreds and it's not slow, but for this maybe maybe we can > break it down by block name and then character name. There is no problem with completion in a new function below created to read a character by its Unicode name or hex number string. There is only a small delay when it creates the completion list, and a longer delay when it displays the *Completions* buffer with all Unicode names: Index: lisp/international/mule-cmds.el =================================================================== RCS file: /sources/emacs/emacs/lisp/international/mule-cmds.el,v retrieving revision 1.333 diff -c -r1.333 mule-cmds.el *** lisp/international/mule-cmds.el 15 Jul 2008 18:15:03 -0000 1.333 --- lisp/international/mule-cmds.el 19 Jul 2008 00:35:23 -0000 *************** *** 2846,2855 **** (defvar nonascii-insert-offset 0 "This variable is obsolete.") (defvar nonascii-translation-table nil "This variable is obsolete.") (defun ucs-insert (arg) "Insert a character of the given Unicode code point. Interactively, prompts for a hex string giving the code." ! (interactive "sUnicode (hex): ") (or (integerp arg) (setq arg (string-to-number arg 16))) (if (or (< arg 0) (> arg #x10FFFF)) --- 2849,2873 ---- (defvar nonascii-insert-offset 0 "This variable is obsolete.") (defvar nonascii-translation-table nil "This variable is obsolete.") + (defun read-char-by-name (prompt) + "Read a character by its Unicode name or hex number string. + Display PROMPT and read a string that represent a character + by its Unicode property `name' or `old-name'. It also accepts + a hexadecimal number of Unicode code point. Returns a character + as a number." + (let (name names) + (dotimes (c #x10FFFF) + (if (setq name (get-char-code-property c 'name)) + (setq names (cons (cons name c) names))) + (if (setq name (get-char-code-property c 'old-name)) + (setq names (cons (cons name c) names)))) + (or (cdr (assoc (setq name (completing-read prompt names)) names)) + (string-to-number name 16)))) + (defun ucs-insert (arg) "Insert a character of the given Unicode code point. Interactively, prompts for a hex string giving the code." ! (interactive (list (read-char-by-name "Unicode (hex or name): "))) (or (integerp arg) (setq arg (string-to-number arg 16))) (if (or (< arg 0) (> arg #x10FFFF)) -- Juri Linkov http://www.jurta.org/emacs/