[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Bug: clocktable doesn't preserve formulas with :scope file-with-arch
[O] Bug: clocktable doesn't preserve formulas with :scope file-with-archives
Fri, 21 Oct 2016 13:13:57 -0500
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:
CLOCK: [2016-10-20 Thu 17:42]--[2016-10-20 Thu 18:03] => 0:21
#+BEGIN: clocktable :scope file-with-archives
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)
Package: Org-mode version 8.2.10 (release_8.2.10 @ /opt/local/share/emacs/25.1/\
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, along with some
I'm attaching a patch but I'm not sure whether you'll be able to use
it because my FSF assignment hasn't been updated for my new employer.
Even if you can't use it, hopefully my description above is still
Description: Binary data
- [O] Bug: clocktable doesn't preserve formulas with :scope file-with-archives,