[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Bug: clocktable doesn't preserve formulas with :scope file-with-
Re: [O] Bug: clocktable doesn't preserve formulas with :scope file-with-archives
Thu, 27 Oct 2016 11:47:39 +0200
Dale <address@hidden> writes:
> Hi! I've found that the "#+TBLFM:" in a clocktable can get changed or
> deleted when used together with ":scope file-with-archives". Here's a
> minimal org file to reproduce with:
> * Test
> CLOCK: [2016-10-20 Thu 17:42]--[2016-10-20 Thu 18:03] => 0:21
> #+BEGIN: clocktable :scope file-with-archives
> #+TBLFM: $3=string("foo")
> Steps to reproduce:
> 1. emacs -Q, load above file with org-mode from Git
> 2. Update clocktable dblock (move to "#+BEGIN" and C-c C-c)
> Expected result: a third column is added with value "foo" in every
> row; #+TBLFM line is preserved
> Observed result: table has two columns, the second of which contains
> "foo" in every row; #+TBLFM line changes from $3=string("foo") to
> If you keep updating the block, the formula's "$2" then becomes "$1".
> Do it one more time and the "#+TBLFM:" is preserved but now the
> formula is gone entirely.
> Emacs : GNU Emacs 25.1.1 (x86_64-apple-darwin15.6.0)
> of 2016-09-23
> Package: Org-mode version 8.2.10 (release_8.2.10 @
> I have also reproduced this with org-mode from Git as of an hour or so ago.
> My hunch is that the problem is in org-clocktable-write-default. It
> writes the table (the dblock's contents have already been deleted),
> restores any #+TBLFM: line that used to be there pre-update, and then,
> if you're using :scope file-with-archives, it deletes the file column,
> which is the first column. The order here is the problem:
> org-table-delete-column updates the formula in #+TBLFM, decrementing
> the column reference to account for the deleted column.
> If this sounds right then I'd suggest that the solution may be as
> simple as just updating org-clocktable-write-default to insert table
> formulas *after* deleting the file column
Thank you for the report and the analysis. This is now fixed.