From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: [PATCH] Re: double-width characters in tables Date: Wed, 13 Feb 2013 21:18:45 +0800 Message-ID: <87obfonyh6.fsf@ericabrahamsen.net> References: <878v6tdcmm.fsf@ericabrahamsen.net> <87vc9xixze.fsf@bzg.ath.cx> <87vc9x4jwq.fsf@ericabrahamsen.net> <877gmdcqzd.fsf@Rainer.invalid> <87a9r93s0o.fsf@ericabrahamsen.net> <87621x3qaj.fsf_-_@ericabrahamsen.net> <87wqucwkwp.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5cA6-0002vI-9h for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 08:14:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5cA4-0000lQ-8m for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 08:14:10 -0500 Received: from plane.gmane.org ([80.91.229.3]:51386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5cA4-0000lM-25 for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 08:14:08 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1U5cAK-0004XI-7X for emacs-orgmode@gnu.org; Wed, 13 Feb 2013 14:14:24 +0100 Received: from 114.250.110.218 ([114.250.110.218]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Feb 2013 14:14:24 +0100 Received: from eric by 114.250.110.218 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Feb 2013 14:14:24 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Bastien writes: > Hi Eric, > > Eric Abrahamsen writes: > >> - l (max 1 (- (match-end 0) (match-beginning 0) 3)) >> + l (max 1 >> + (- (org-string-width >> + (buffer-substring >> + (match-end 0) (match-beginning 0))) 3)) > > (Why not just (org-string-width (match-string 0))?) > > Let me know when you're done with extensive testing for this! I think the reason I went with buffer-substring is that it will *fix* messed up justification. (match-string 0) will not mess up the justification if it's already correct, but it won't fix it if it isn't. Actually, shortly after sending that patch I moved to using buffer-substring-no-properties, which has the added benefit that fields with links or other types of hidden text will justify correctly. Unless I'm mistaken, putting links in table fields will currently result in too-short justification as handled by org-table-justify-field-maybe (as always, a full re-align with org-table-align fixes things). Unless the buffer-substring call is particularly expensive, I think it's worth it. Re testing: apart from mixing scripts and languages in one field, what else should be tested? You mentioned cleaning up other problems while we're at it -- does anyone have anything outstanding? Inevitably (I think), none of this works when the wrong typeface is being used for particular characters. I have no specifications for Cyrillic, for example, which means my system renders it in with a Chinese typeface, resulting in double-wide glyphs for characters that should be single-width, and bad table justification. I think this has to be addressed by the user. E