From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bake Timmons Subject: Re: [PATCH]: Fix to spreadsheet ranges in A1 style Date: Mon, 20 Aug 2007 09:42:13 -0400 Message-ID: <87zm0miaq2.fsf@freed.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IN7WL-0008PA-MH for emacs-orgmode@gnu.org; Mon, 20 Aug 2007 09:42:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IN7WK-0008N0-4d for emacs-orgmode@gnu.org; Mon, 20 Aug 2007 09:42:17 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IN7WK-0008Mq-0n for emacs-orgmode@gnu.org; Mon, 20 Aug 2007 09:42:16 -0400 Received: from smtp103.vzn.mail.dcn.yahoo.com ([209.73.179.141]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IN7WJ-0005ZY-BY for emacs-orgmode@gnu.org; Mon, 20 Aug 2007 09:42:15 -0400 Received: from b3po by freed.localdomain with local (Exim 4.60) (envelope-from ) id 1IN7WH-0001KI-BD for emacs-orgmode@gnu.org; Mon, 20 Aug 2007 09:42:13 -0400 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: emacs-orgmode@gnu.org Carsten Dominik writes: > On Aug 20, 2007, at 4:46, Bake Timmons wrote: >> (concat "[" (mapconcat >> (lambda (x) >> @@ -9131,8 +9132,11 @@ >> ((match-end 3) >> ;; format match, just advance >> (setq start (match-end 0))) >> - ((and (> (match-beginning 0) 0) >> - (equal ?. (aref s (max (1- (match-beginning 0)) 0)))) >> + ((let ((pos (match-beginning 0))) >> + (and (> pos 0) >> + (equal ?. (aref s (1- pos))) >> + ;; not using .. for a range reference >> + (or (< pos 2) (not (equal ?. (aref s (1- pos))))))) >> ;; 3.e5 or something like this. FIXME: is this ok???? >> (setq start (match-end 0))) >> (t > > Could you please explain this part of the patch to me? > Thanks. After fixing the mapconcat bug, I reloaded the code and observed an erroneous conversion of a range in an elisp formula. E.g., during formula debugging A1..B1 becomes @1$1..B1 instead of @1$1..@1$2. More debugging showed that A1 match correctly takes the final branch of the cond within the org-table-convert-refs-to-rc function and is converted, but that the match for B1 erroneously matched the second condition of the cond form, i.e., it is treated as something in scientific notation and is incorrectly skipped over. Thus, I changed the test to ensure that no additional "." is adjacent to the already recognized ".". Moreover, I eliminated the max function call, since a positive number minus one is already nonnegative. Thanks.