From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: faster unicode character name completion Date: Fri, 04 Dec 2009 10:07:57 -0500 Message-ID: References: <87einfbxdw.fsf@red-bean.com> <87fx7r68s4.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259939350 4615 80.91.229.12 (4 Dec 2009 15:09:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Dec 2009 15:09:10 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 04 16:08:59 2009 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 1NGZmD-0003H1-Kn for ged-emacs-devel@m.gmane.org; Fri, 04 Dec 2009 16:08:57 +0100 Original-Received: from localhost ([127.0.0.1]:48747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGZmC-0003oZ-Uq for ged-emacs-devel@m.gmane.org; Fri, 04 Dec 2009 10:08:56 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGZlN-0003cW-Os for emacs-devel@gnu.org; Fri, 04 Dec 2009 10:08:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGZlH-0003aP-If for emacs-devel@gnu.org; Fri, 04 Dec 2009 10:08:04 -0500 Original-Received: from [199.232.76.173] (port=47604 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGZlH-0003aM-Ft for emacs-devel@gnu.org; Fri, 04 Dec 2009 10:07:59 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:7000 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGZlH-0002nn-8N for emacs-devel@gnu.org; Fri, 04 Dec 2009 10:07:59 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhcFAOa0GEtFpZ1E/2dsb2JhbACBTtYUhDMEihs X-IronPort-AV: E=Sophos;i="4.47,342,1257138000"; d="scan'208";a="50684000" Original-Received: from 69-165-157-68.dsl.teksavvy.com (HELO pastel.home) ([69.165.157.68]) by ironport2-out.pppoe.ca with ESMTP; 04 Dec 2009 10:07:58 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 9B5F286C4; Fri, 4 Dec 2009 10:07:57 -0500 (EST) In-Reply-To: (Kenichi Handa's message of "Fri, 04 Dec 2009 20:23:34 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:118259 Archived-At: > The drawback of the new code is that one can see only the > list of the first words of character names in the completion > buffer at once by C-x 8 RET TAB, instead of all of the > unicode character names. That's a pretty serious drawback as it prevents uses such as C-x 8 RET *arro TAB. Maybe another way to speed things up is to precompute the ucs-completions lazy completion table at compilation time and store it in a .elc file, so it can be "computed" by reading that file. This can be done simply by having an autoloaded `ucs-completions' function in a file where the ucs-completions variable is defined with an eval-when-compile expression. > (defun ucs-name-filter (str names) > (let (l) > (dolist (elt names) > (if (eq (string-match str (car elt)) 0) > (push elt l))) > l)) > (defun ucs-name-completion (str) > (when (string-match "^[A-Za-z]*" str) > (let ((head (match-string 0 str)) > slot names) > (if (and (= (length head) (length str)) > (not (assoc-string str ucs-name-head-table))) > (ucs-name-filter str ucs-name-head-table) > (ucs-name-filter str (ucs-name-expand-table head)))))) I don't understand what ucs-name-filter is trying to do. Stefan