From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Adding new table rows/cols in a formula update Date: Wed, 01 Oct 2014 16:17:59 -0400 Message-ID: <87iok3h7d4.fsf@alphaville.bos.redhat.com> References: <87k34mgvup.fsf@secretsauce.net> <87fvf8hpqw.fsf@secretsauce.net> <87egusgx72.fsf@secretsauce.net> <8738b78tt0.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZQLp-0002b3-6k for emacs-orgmode@gnu.org; Wed, 01 Oct 2014 16:18:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZQLk-0000Wn-4X for emacs-orgmode@gnu.org; Wed, 01 Oct 2014 16:18:17 -0400 Received: from plane.gmane.org ([80.91.229.3]:48480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZQLj-0000Wf-UE for emacs-orgmode@gnu.org; Wed, 01 Oct 2014 16:18:12 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XZQLi-0004RZ-M3 for emacs-orgmode@gnu.org; Wed, 01 Oct 2014 22:18:10 +0200 Received: from nat-pool-bos-t.redhat.com ([66.187.233.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Oct 2014 22:18:10 +0200 Received: from ndokos by nat-pool-bos-t.redhat.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Oct 2014 22:18:10 +0200 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 Nicolas Goaziou writes: > Hello, > > Dima Kogan writes: > >> OK. Patch attached. > > Thanks for your patch. Some comments follow. > >> From 3b6581c647cb87f0d3e8cee94ce2fb1fb122d3fd Mon Sep 17 00:00:00 2001 >> From: Dima Kogan >> Date: Tue, 30 Sep 2014 22:36:21 -0700 >> Subject: [PATCH] Field formulas can now add columns as needed >> >> The org-table-formula-make-new-cols customization controls whether and how this >> is done > > Your commit message is missing information and "TINYCHANGE" at its end. > See http://orgmode.org/worg/org-contribute.html#sec-5 > >> +(defcustom org-table-formula-make-new-cols nil > > What about `org-table-formula-create-columns'? > >> + "Non-nil means that evaluation of a field formula can add new >> +columns if an out-of-bounds field is being set." > > First line needs to be complete. E.g., > > "Non-nil means a field formula can create a new column." > >> + :group 'org-table-calculation >> + :type '(choice >> + (const :tag "Setting an out-of-bounds field generates an error (default)" nil) >> + (const :tag "Setting an out-of-bounds field silently adds columns as needed" t) >> + (const :tag "Setting an out-of-bounds field adds columns as needed, but issues a warning message" warn) >> + (const :tag "When setting an out-of-bounds field, the user is >> prompted" prompt))) > > You need to add :version and :package-version keywords. > >> (defgroup org-table-import-export nil >> "Options concerning table import and export in Org-mode." >> :tag "Org Table Import Export" >> @@ -3125,7 +3135,22 @@ known that the table will be realigned a little later anyway." >> (while (setq eq (pop eqlname1)) >> (message "Re-applying formula to field: %s" (car eq)) >> (org-goto-line (nth 1 eq)) >> - (org-table-goto-column (nth 2 eq)) >> + (let* ((column-target (nth 2 eq)) >> + (column-count (progn (end-of-line) >> + (1- (org-table-current-column)))) >> + (create-new-column >> + (and (> column-target column-count) > > Is this check really necessary? Doesn't `org-table-goto-column' already > figures it out before creating a new column? > > > Regards, Does it need sanity checking? A typo in a formula can create "billions and billions"[fn:1] of columns inadvertently. Footnotes: [fn:1] with apologies to Carl Sagan (RIP)...