From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Alignment problem with org-format-org-table-html Date: Thu, 29 Apr 2010 15:01:36 +0200 Message-ID: <46DF2383-867C-4D8A-8A3A-265E39CAB70D@gmail.com> References: <4BD72F7F.70607@portnoy.org> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O7TNU-0003sQ-Az for emacs-orgmode@gnu.org; Thu, 29 Apr 2010 09:02:04 -0400 Received: from [140.186.70.92] (port=40889 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O7TNL-0003ro-83 for emacs-orgmode@gnu.org; Thu, 29 Apr 2010 09:02:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O7TN6-00059S-9m for emacs-orgmode@gnu.org; Thu, 29 Apr 2010 09:01:42 -0400 Received: from mail-ew0-f214.google.com ([209.85.219.214]:33268) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O7TN6-00059D-5C for emacs-orgmode@gnu.org; Thu, 29 Apr 2010 09:01:40 -0400 Received: by ewy6 with SMTP id 6so6017378ewy.32 for ; Thu, 29 Apr 2010 06:01:39 -0700 (PDT) In-Reply-To: <4BD72F7F.70607@portnoy.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Stephen Peters Cc: emacs-orgmode@gnu.org Hi Stephen, nice catch, thank you very much! I have applied the patch. - Carsten On Apr 27, 2010, at 8:39 PM, Stephen Peters wrote: > When creating a table, I was noticing that the > ... provides useful alignment information based on > whether or not the column has numbers in it. I think, however, that > there is a mistake in this routine. Take, for example, the following > table: > > | Id | Task | Developer | Estimate | Spent | Remaining | > Comp.% | Updated | > |-----+--------------+-----------+----------+-------+----------- > +--------+-----------------| > | 1 | Task One | SLP | 1 | 0 | 1 > | 0 | SLP, 2010-04-27 | > | 2 | Task Two | SLP | 1 | 0 | 1 > | 0 | SLP, 2010-04-27 | > | 3 | Task Three | SLP | 2 | 0 | 2 > | 0 | SLP, 2010-04-27 | > | 4 | Task Four | SLP | 2 | 0 | 2 > | 0 | SLP, 2010-04-27 | > | 5 | Task Five | SLP | .25 | 0 | 0.25 > | 0 | SLP, 2010-04-27 | > | 5.1 | Another Task | XML team | 0 | 1 | 0 > | 0 | SLP, 2010-04-27 | > | 6 | Task Six | SLP | .25 | 0 | 0.25 > | 0 | SLP, 2010-04-27 | > | 6.1 | More Tasks | DB team | 3 | 0 | 3 > | 0 | SLP, 2010-04-27 | > | 7 | Task Seven | SLP | 3 | 0 | 3 > | 0 | SLP, 2010-04-27 | > > When the colgroup list is created for this table, it reads: > > align="left" /> align="left" /> > > > Note that the first columns are correct, but the last few are not. > It should read right, left, left, right, right, right, right, left. > > I believe that this is due to the (< i nline) comparison within org- > format-org-table-html, which is nonsensical because it's trying to > compare a column number with a number of rows. I've attached a > patch for the problem. > > > > diff --git a/lisp/org-html.el b/lisp/org-html.el > index 3ac2b18..0ffde15 100644 > --- a/lisp/org-html.el > +++ b/lisp/org-html.el > @@ -1659,8 +1659,7 @@ lang=\"%s\" xml:lang=\"%s\"> > (mapconcat > (lambda (x) > (setq i (1+ i)) > - (if (and (< i nline) > - (string-match org-table-number-regexp x)) > + (if (string-match org-table-number-regexp x) > (incf (aref fnum i))) > (cond > (head > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten