From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Unicode Lisp reader escapes Date: Thu, 04 May 2006 15:07:36 +0200 Message-ID: References: <17491.34779.959316.484740@parhasard.net> <87odyfnqcj.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1146748203 5729 80.91.229.2 (4 May 2006 13:10:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 4 May 2006 13:10:03 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 04 15:09:58 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FbdaV-0001lH-KH for ged-emacs-devel@m.gmane.org; Thu, 04 May 2006 15:09:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FbdaV-0001lz-37 for ged-emacs-devel@m.gmane.org; Thu, 04 May 2006 09:09:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FbdaA-0001cB-T9 for emacs-devel@gnu.org; Thu, 04 May 2006 09:09:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fbda7-0001b9-Tl for emacs-devel@gnu.org; Thu, 04 May 2006 09:09:26 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fbda7-0001b5-Il for emacs-devel@gnu.org; Thu, 04 May 2006 09:09:23 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Fbdaj-0001fc-Ad for emacs-devel@gnu.org; Thu, 04 May 2006 09:10:01 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FbdZi-0001Yv-AH for emacs-devel@gnu.org; Thu, 04 May 2006 15:08:58 +0200 Original-Received: from dslb-084-058-181-057.pools.arcor-ip.net ([84.58.181.57]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 04 May 2006 15:08:58 +0200 Original-Received: from alkibiades by dslb-084-058-181-057.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 04 May 2006 15:08:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 42 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: dslb-084-058-181-057.pools.arcor-ip.net User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:53900 Archived-At: storm@cua.dk (Kim F. Storm) writes: > Oliver Scholz writes: > >> Here's the patch, only slightly tested: > >> + >> +/* Return the internal character coresponding to an UCS code point.*/ >> + >> +int >> +ucs_to_internal (ucs) >> + int ucs; >> +{ >> + if (! EQ (Qnil, SYMBOL_VALUE (intern ("utf-translate-cjk-mode")))) >> + if (EQ (Qnil, SYMBOL_VALUE (intern ("utf-translate-cjk-lang-env")))) >> + call0 (intern ("utf-translate-cjk-load-tables")); >> + Fget (intern ("utf-subst-table-for-decode"), >> + intern ("translation-hash-table")), >> + Lisp_Object vect = Fget (intern ("utf-translation-table-for-decode"), >> + intern ("translation-table")); >> +} > > That's 7 lisp vars accessed from C - for decoding one character!?! Nearly inevitable, if you want to DTRT with CJK. > How often does this happen? Every time a character specified with \u is decoded. The call0, however, probably just once per Emacs session. > If it is only/primarily used for interactive use, I guess it doesn't matter. > Otherwise, I think those vars should be declared in C, to avoid the overhead > of interning them at run-time... I tend to agree; but that is probably too intrusive. Oliver -- 15 Floréal an 214 de la Révolution Liberté, Egalité, Fraternité!