emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Dale <dale@codefu.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: clocktable doesn't preserve formulas with :scope file-with-archives
Date: Thu, 27 Oct 2016 11:47:39 +0200	[thread overview]
Message-ID: <87eg32i0n8.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAEj9N4JSvxyXWxaJAEkKe6=L70GrcWhsiOyS07CR-bs3BoGoVQ@mail.gmail.com> (dale@codefu.org's message of "Fri, 21 Oct 2016 13:13:57 -0500")

Hello,

Dale <dale@codefu.org> 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:
>
> ------8<------
> * Test
> :LOGBOOK:
> CLOCK: [2016-10-20 Thu 17:42]--[2016-10-20 Thu 18:03] =>  0:21
> :END:
>
> #+BEGIN: clocktable :scope file-with-archives
> #+TBLFM: $3=string("foo")
>
> #+END:
> ------8<------
>
> 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
> $2=string("foo")
>
> 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 @ /opt/local/share/emacs/25.1/\
> lisp/org/)
>
> 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.

Regards,

-- 
Nicolas Goaziou

      reply	other threads:[~2016-10-27  9:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21 18:13 Bug: clocktable doesn't preserve formulas with :scope file-with-archives Dale
2016-10-27  9:47 ` Nicolas Goaziou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eg32i0n8.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=dale@codefu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).