Iterating over the current set of file names may not work when no files are
given (in which case all agenda files should be visisted). However, instead of
fixing the set of files, it should be more robust to find all referenced buffers
by iterating over the markers of the entries. In that case, even if a file is
visited by multiple buffers, we can be sure that the right buffers are referesh
before the timeline is redrawn.
This reenables automatic gap filling in case it has been configure with
`timeline-tools-filter-functions', but somehow breaks undo of killing in the
timeline buffer. The problem seems to be that undoing a kill only restores the
killed line, but not the original line entries of the lines right before and
after the lined that had been killed. In this way, the timeline of the buffer
has overlapping entries, resulting in odd behavior.
The problem is not quite understood yet, but it seems to be that undo does not
notice the changes to the surrounding lines (maybe because they have not been
done by text editing functions).
This does not play nicely with undo, because undo won't track changes to local
variables. Thus, if we every want to have a working undo in timeline buffers,
the timeline needs to be saved as something textual. Luckily, we already store
each entry of the timeline as a text property in the timeline table, and from
now on we will extract the timeline from there whenever we need it.
Undo is still not working fully yet, there are some oddities that need to be
addressed first.
It's only necessary when editing the buffer, not when only traversing it. Moved
it to the only function where this is actually done, and added a comment to the
docstring of `timeline-tools-map-clocklines' to remind everyone that editing the
buffer through this function may yield funny surprises :)
Actually, we add the text properties ‘marker’ and ‘entry’ to the whole line, but
the alinging of the table somehow removes the text properties between two
columns. It is kept in the fields, though, and that is enough.
For this a new function ‘timeline-tools-clockline-no-org-agenda-conflicts’ as
been added that reads in a clock line (start and end times), updates all org
agenda files to fix conflicting clock lines, and returns the string of the new
clock line. This works for all complete clock lines (i.e., those with end
times), but not for open clock lines (i.e., those missing an end timestamp).
Undoing changes in the timeline buffer may make the display inconsistent with
the values of the internal variables (in particular when lines got killed and
the like).