Commit Graph

454 Commits

Author SHA1 Message Date
f948f3dca3
Make skip-matches also skip computations in workload overview report
This avoids unnecessary computations.
2024-10-03 09:54:15 +02:00
d0b126ec54
Add missing id: prefix when adding DATE references to checklists
Forgot this, oops.
2024-09-19 15:47:47 +02:00
dbda1928ce
Catch errors on user clock choice to ensure continuous clocking 2024-09-15 13:09:12 +02:00
75b54128bd
Ignore SOMEWHEN items in checklist backlinks
Since these are deferred items, they don't have to show up in checklists.
2024-08-25 09:07:46 +02:00
d01b3bdc09
Add clocktable formatter to filter entries with small clocking time
Whenever I try to check what I actually in the past couple of days, I
try to use a clocktable for this.  However, those clocktables are
usually littered with small entries, i.e. entries where I only spent a
couple of minutes on (example: a quick chat with a colleague).  Those
entries clutter the view for the relevant entries, making it hard to
make sense of past activities.

Restricting the clocktable to a certain depth somehow helps, but major
single tasks are hidden this way, and I usually want to see those.

The custom formatter added in this commit tries to alleviate this
situation by providing a mechanism to filter out those entries using a
minimum clocktime threshold.  Let's see how this feature plays out.
2024-08-17 16:07:17 +02:00
33b7d5d8d3
Allow to skip entries in workload-overview-reports
This is especially useful when skipping weekends, but also allows for
future extensions where based on the date more complex skipping criteria
can be implemented, e.g. for holidays or vacations.
2024-08-02 18:42:59 +02:00
f110d147fa
Improve implementation to find next started or open checkbox
The algorithm has been simplified and has been commented where
appropriate (from my point of view).  An extensive docstring has been
added to describe the intention of the approch and its recursive nature.
2024-07-12 08:58:01 +02:00
4a1509981b
Descend into sublists when searching for first open checkbox 2024-07-11 21:53:56 +02:00
21200d8bc4
Try to refine Org QL query for currently active DATE entries
`ts-now` should be better than `today`, as it includes the current time.
2024-07-10 15:24:08 +02:00
7309cee413
Insert active concurrent DATE entries when inserting checklist
Those DATE entries may be relevant to the item at hand.

Caveat: the query to determine active, concurrent DATE entries is not
quite right yet, two disjoint time ranges that do not include today but
cover the past and the future would also be considered as concurrent
active date.  This needs to be fixed.
2024-07-06 13:50:33 +02:00
94187697e6
Remove checklist entry for relevant backlinks when there are none
The original motivation to keep this entry was to signify that backlinks
where searched for, but none where found.  However, I now think that it
is enough to just rely on the code to search for relevant backlinks, and
where there are none, to just print nothing.
2024-07-06 12:51:51 +02:00
2318ffa199
Add handling for ledger errors when converting to Org tables 2024-07-06 12:03:46 +02:00
7d75bae3ed
Hide drawers when jumping to current clock via custom function
Open drawers confuse me.
2024-07-06 09:42:32 +02:00
6f4baa885e
Conduct a bit of refactoring for ledger to Org table converter 2024-07-01 20:52:40 +02:00
e7c08b088d
Introduce helper function to format Ledger CLI output as Org table
This function is ideal, but it's doing the job.  It can be used to
format output of calls to ledger as follows:

    #+begin_src emacs-lisp :results value raw table
    (db/ledger-cli-to-org-table-list
     (concat "ledger -f finance.ledger "
             "--period monthly --depth 2 "
             "--display 'd >= [2024-07-01]' "
             "--empty "
             "lisp ^Expense"))
    #+end_src
2024-07-01 20:11:40 +02:00
1f348e256d
Disable refile verification when jumping to any Org item
Any item could be of interest, not only those that are valid refile
targets.

This might be slow.  May we should not be using the refile mechanism to
jump to any item?
2024-04-01 11:16:15 +02:00
63eeefcb8e
Ignore backlink items tagged HOLD in default checklist
Items tagged with HOLD should be ignored in normal processes and should
thus not appear as backlinks.  Items tagged WAIT are supposed to appear,
though, and are not excluded from the list of relevant backlinks.
2024-03-25 17:48:50 +01:00
8876f04756
Harden shortcut to jump to any Org heading from anywhere
In the previous implementation, when in some buffer which is not an Org
buffer that accidentally contains lines that partially match the regular
expression describing an Org heading, errors could occur when the Org
refile cache was empty.  To address this issue, let's temporarily switch
to some Org buffer before generating the list of all Org heading
targets.
2024-03-16 17:08:00 +01:00
7d398a66c8
Replace counsel Org heading dispatch by org-refile
This is nice enough and removes the last dependency to counsel :)
2024-03-09 15:04:21 +01:00
aadca01244
Simplify Org clocking hydra
No need to define an anonymous function her, just make the call
directly.
2024-03-09 15:03:10 +01:00
1cc7abd4d7
Clarify that remaining time is computed over clocked time of subtree 2024-01-22 19:52:27 +01:00
af05bd2106
Collect custom Org key bindings in a custom hydra 2024-01-07 17:12:27 +01:00
b7d190c513
Introduce separate hydra for Org jump commands
`hydra-org-clock` thus only hosts keybindings for clock-related
commands, while the new `hydra-org-jump` is for jumping to Org items in
various ways.  Feels cleaner to me this way.
2024-01-01 17:04:55 +01:00
5ebeeef3fd
Ensure point is on current clock when setting default task
Not sure whether this is the case otherwise.

Also add output when the default task is set, to see when it's set
accidentally.
2023-12-10 19:04:07 +01:00
d1e3409e80
Only search for parent task for clock continuation when necessary
Avoid unnessary work by leveraging the fact that `setq` returns the new
value of the variable being set :D
2023-12-08 17:45:10 +01:00
498f4b78c4
Automatically clock into interrupted task only when not closed yet
This is to avoid jumping back to old task that are still pointed at by
`org-clock-interrupted-task` that have long been closed.  Let's see
whether this is enough to handle this case.
2023-12-08 17:43:59 +01:00
7128144ee0
Fix errors in some docstrings 2023-12-08 17:27:29 +01:00
482cebea68
Fix docstring for clock continuation function
Forgot to adapt this previously.
2023-12-06 16:40:56 +01:00
416ba934f9
Resume clock at interrupted task when available 2023-12-06 16:31:05 +01:00
2407f4196f
Fix typo in hydra docstring 2023-11-05 12:04:38 +01:00
a959152d21
Increase highlighting of valid keys in Org clock hydra
This improves spotting the available keys, I think.
2023-11-04 09:35:40 +01:00
f14a5b6237
Make default Org clock hydra a bit more descriptive 2023-11-03 16:55:24 +01:00
44b78dbef1
Make main Org hydra a bit more consistent and self documenting
In particular, use “j” instead of “c” for jumping to the current clock, like the
standard Org bindings use it.
2023-11-01 21:06:35 +01:00
aeff0883bb
Fix missing description in main Org hydra 2023-10-23 17:37:38 +02:00
badbb85da0
Ensure org-password-manager is loaded when loading password by ID
Otherwise, `org-password-manager-default-password-wait-time` may be undefined
during runtime.
2023-08-18 19:21:14 +02:00
a6324a668d
Move custom org-password function to db-org
This is where it belongs, even if there's a warning about free variable
referencing.
2023-08-17 17:06:42 +02:00
e30ab3f260
Ensure inserting links works when the source buffer is narrowed 2023-08-15 18:11:47 +02:00
d6ffc0ba40
Avoid duplicate backlink targets in backlink reports
I am not sure yet when duplicate entries happen, but they do happen
occasionally.
2023-08-12 10:52:58 +02:00
e892a849c1
Allow to set an initial input when inserting a link to another item
This will allow to bind `db/org-add-link-to-other-item` with different initial
inputs to different keys to have often used selection directly at hand.

Setting the initial input is a bit tricky, though, because
`org-refile-get-location` does not allow to set it.  Instead, we have to
temporarily overwrite `completing-read` with the corresponding parameter set
directly.
2023-07-29 20:08:19 +02:00
c0660fe0f6
Give argument of db/org-get-location a more descriptive name
It's not a universal arguments, so calling it ARG is not only just
non-informative, but also misleading.
2023-07-29 19:50:12 +02:00
56f60e97d3
Add shortcut to jump to current clock in main Org hydra
Had forgotten about that one, sorry.
2023-07-21 10:26:44 +02:00
1d33039dde
Unfold subtree before evaluating all source blocks
This is meant to mitigate an issue with table alignment when those tables are
results of source blocks, contain links in cells and are hidden (i.e., folded):
in those circumstances, the table alignment seems to be broken, because the cell
width does not take into account that links are shorter than their textual
representation.

I am not quite sure whether this is a bug in my configuration or a bug in Org
mode itself.  The function to compute cell width is `org-string-width`, but
maybe this function does not get passed the correct input when tables are folded
and need to be aligned?
2023-07-17 20:14:09 +02:00
3bb5b4481d
Search through all Org mode buffers when inserting backlinks
This seems to be fast enough, and since I often find myself aborting a current
backlink insertion query because I missed to include all Org mode buffers,
making it the default only seems to be reasonable.
2023-07-02 16:44:36 +02:00
9ff7c848a1
Change shortcut for interactive clock selection
This is for consistency with all other commands that use "s" to select a running
clock from the history.
2023-05-28 15:30:18 +02:00
f8caaae071
Allow adding links to Org items also in non-Org-mode buffers
The relevant use-case (for me at least) is to insert links to Org items in the
minibuffer when capturing new items.
2023-05-26 18:08:22 +02:00
113f3f4495
Fix invalid logic for nil dates in workload report
When not provided in dynamic workload reports, `start-date` and `end-date`
should be treated as unconstrainted.  However, instead dates were queried
interactively in that case, because `org-read-date` is being used to normalize
date display.  Fixed that.
2023-05-24 19:25:02 +02:00
a4712cf155
Include items in workload overview planned before given start date 2023-05-24 18:59:39 +02:00
cac41d0759
Do not recenter position when jumping to current clock
This keeps the current view as it is in case it's already visible in some
buffer.
2023-05-16 18:26:14 +02:00
58e5cd3506
Jump to headline of the currently clocked item when going there
Before this change, we went to the position of the open clock, which is not
where we want to be in case no open checklist item is found.
2023-05-16 18:25:00 +02:00
0b315f44a3
Go to Org item when trying to insert checklist directly in agenda
This is expected behavior in my point of view.
2023-05-13 10:30:29 +02:00
01b5e1b8db
Fix incorrect restriction handling when inserting templates
We must widen the current restriction when searching for the template item, not
when copying the body from it.  In the latter case, `org-with-point-at` will
handle the necessary widening.
2023-05-06 18:03:14 +02:00
925cf115be
Remove ID and CUSTOM_ID properties when inserting checklist template
When the template associated with the item at point contains sub-items itself,
those may have been assigned ID or CUSTOM_ID properties.  Copying the template
would thus duplicate these properties, violating their implicit uniqueness
constraint, so we now remove those properties from the inserted checklist
template.
2023-05-06 16:54:38 +02:00
fa56dfdd4d
Ensure CHECKLIST_INSERTED_P will be inserted at original heading
When a checklist template contains headings on its own, the
`CHECKLIST_INSERTED_P` property until now would be inserted at the last heading
in this template, instead of at the heading where the template is supposed to be
inserted in the first place.  Fixed this.
2023-05-06 15:30:16 +02:00
b67a920780
Fix wrong search region for inserting active filter display 2023-04-29 17:35:20 +02:00
a44b7b660e
Remove obsolete function to skip tags in agenda views 2023-04-29 17:28:35 +02:00
8c9c47f6e3
Prominently display of active filters in agenda view
Displaying the current filters in the mode line alone often goes unnoticed for
me, so I need a more direct display.  Let's add it to the first structural
header.
2023-04-29 17:27:50 +02:00
71f07d1e8f
Remedy some flycheck and checkdoc warnings coming from db-org.el 2023-04-07 12:52:35 +02:00
347a3bf08d
Clean up personal Org utility functions
Mostly moving functions around and updating page headers.  Also removed some
obsolete functions, see updated command list for `db-org` use-package
declaration.
2023-04-07 11:49:58 +02:00
c3a96fc342
Use display-buffer when jumping to currently clocked item 2023-04-06 18:10:56 +02:00
c061357893
Note current limitation in computation of remaining effort time 2023-04-06 17:58:22 +02:00
f120e4b01f
Remove redundant conversion of remaining effort durations
When sorting, we need the remaining efforts as numbers, so let's return those
numbers directly instead of first converting them to durations only for them to
be converted back to numbers.
2023-04-02 10:36:13 +02:00
866f652c4b
Fix nil display in agenda when remaining effort is not set
Just return the empty string instead.
2023-04-01 17:01:00 +02:00
0a14f01729
Sort agenda entries by remaining effort by default
This might be slow and buggy, but let's keep it for now.
2023-04-01 16:57:37 +02:00
1f9e032a1a
Display remaining effort in Org agenda by default
Note that sorting is wrong now, this needs to be fixed later.
2023-04-01 16:50:30 +02:00
13cbd90ec6
Improve checklist insertion
Do not reveal whole subtree, but only the body.  Also jump to first open
checklist item after checklist insertion.
2023-03-21 16:52:27 +01:00
ba9edc5f12
Display remaining effort of items in workload reports
This is rather experimental, but seems to work fine so far.  The most
complicated part is to compute the overall clocked time of an item.

Any clocktime modifiers like “today” or “total” are currently ignored.
2023-03-19 20:56:15 +01:00
10ee65f55a
Automatically set property to avoid double checklist insertions 2023-03-19 13:21:18 +01:00
efa55cb75d
Insert checklists at end of subtrees, before possible children 2023-03-19 13:14:01 +01:00
26d9dc0614
Make inserting whitespaces around checklist a bit more intelligent
Not quite sure yet whether this is really it, and maybe it would be better to
create some new utility functions to ensure enough blank lines before and after
point.  But let's try it out first and fix it later.
2023-03-11 09:47:42 +01:00
ddbcfee3d9
Allow to jump to template checklist instead of inserting it
This is a convenience shortcut.  Maybe the code to insert the complete checklist
also needs to go into another function, for implementatio clarity.  Do this as
soon as it seems appropriate or necessary.
2023-03-05 16:35:23 +01:00
c5f1e98bf8
Make storing note upon headline change more robust
Let's not wait until our code turns out to be broken, but fix it now.
2023-02-14 16:42:34 +01:00
fb60b22c5e
Reference blog entry showing how to programmatically add Org notes
The current implementation of `db/org-update-headline-log-note` seems to be
fine, but if it turns out to be broken, we can try the approach of Sacha Chua.
2023-02-14 16:30:10 +01:00
9b8d3d6d44
Ignore duplicates when computing daily agenda effort 2023-02-12 13:49:43 +01:00
95920f8291
Extend default scope for db/org-get-location when in agenda files
When inside a file that is part of `org-agenda-file`, the default scope to
search for locations via `db/org-get-location` (used for example when
interactively inserting links) is extended to include all agenda files, and not
only the current buffer.  The idea behind this is to consider all agenda files
as one large data collection, and not only individual files.  This inhibits the
usual error, when trying to insert links at items located in refile.org, that
links are only displayed for items in refile.org itself – which are usually not
many – when instead links to items in the default org files where actually
requested.

This should not be an issue for performance, as searching through all agenda
files for valid locations is fast even on Windows.
2023-01-20 18:39:00 +01:00
d9b0543409
Remove obsolete warning in workload overview report docstring 2023-01-16 19:21:49 +01:00
d373976965
Fix off-by-one error in workload overview report end-date handling
Pushed one to much, so just removed it afterwards.
2023-01-16 19:20:44 +01:00
558bb0b1cc
Make timestamp format in workload overview report consistent
Brackets for both timestamps.
2023-01-16 19:16:04 +01:00
bb7da2e08e
Change timestamp format in workload overview report to internal time
`org-read-date` seems to have bug that it does not consider the hh:mm part of an
input string sometimes.  Trying to work around this by using internal times
whenever possible, but it's not complete yet.
2023-01-16 19:09:04 +01:00
4e5cad2842
Fix off-by-one error in workload overview report
Found that the report will only produce reasonable output when always working on
00:00.  Left a note in the docstring to warn about this, should be fixed later on.
2023-01-16 17:26:32 +01:00
d699fc8450
Add property to exclude individual Org items as checklist backlinks
Use case: do not add a workload report (which usually contains links to all
current tasks) when inserting checklist backlinks; they do not carry any
information and are thus not relevant.
2023-01-13 22:31:41 +01:00
fc4d6b7767
Fix some identation
but not all, in particular not the one of the `cl-flet` call; see
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9622 for this.
2023-01-12 16:46:26 +01:00
f534833520
Add caption with time for workload reports
Those reports are only relevant when known when they have been generated.

This is similar to the caption added to dynamic clocktable blocks.
2023-01-12 16:33:07 +01:00
2423dcf6cd
Fix start date in workload overview report to midnight
This is the expected behavior: when no start date is given, it should default to
today (the whole day), and not exactly now, so that day increments do not start
in the mid of the day, yielding misleading results.
2023-01-11 21:17:02 +01:00
28b2047ad6
Fix stacking of summed effort estimations upon agenda refresh
When refreshing the Org agenda without completing redrawing it (i.e, by calling
`org-agenda-filter-by-tag`), effort estimates where added for every refreshing,
causing them to stack up.  We now check whether a summed effort estimate is
already present and remove it before adding it again.

(Maybe one could also just skip the effort recalculation if the a summed effort
estimate is already present, but I am not sure whether this will cause display
inconsistencies when new events are added or old ones are deleted.)
2023-01-11 20:44:19 +01:00
6ed088d2da
Fix missing summation of time blocks in agenda 2023-01-11 20:22:29 +01:00
a54ade74a4
Push links to Org items always to top of currently known links
When adding a link to an item via `org-store-link`, and the link is not known
yet, the links is always put at the beginning of the list of currently known
links, as stored in `org-stored-links`.  This allows to conveniently insert this
link via `org-insert-link` by just choosing the first element of the list, which
is selected by default.

However, when the link to the requested item is already present in
`org-stored-links`, the link is not pushed to the beginning of
`org-stored-links` by `org-store-link`, but kept where it is.  When calling
`org-insert-link` to insert a link to the item, manual selection of the correct
link is required, which is annoying and unnecessarily interrupting the current
workflow.  Even worse, when overlooking the notification that the link is
already stored, one will assume that the link to the requested item is at the
top of `org-stored-links` (which is isn't), subsequently inserting false links
when blindly calling `org-insert-link`.  (Yes, this has happend to me …)

This patch fixes this issue by ensuring that links to items (regardless whether
they have already been known or not) are always put at the front of the
`org-stored-links`.  This patch also removes the rarely used
`db/org-clear-stored-links` function, whose purpose was to provide some kind of
workaround, but turned out not to be convenient enough to actually be
used (because it also removed potentially useful links when clearing the cache).
2022-12-20 08:46:47 +01:00
7c9f795a38
Add function to jump to template associated with the item at point 2022-12-15 14:16:52 +01:00
64bc1c762b
Jump to first open checkbox in currently clocked-in item by default
When no open checkbox is found, just jump to the headline of the item, as
before.
2022-11-19 16:09:38 +01:00
69f3f80a6e
Allow empty template when inserting checklists to Org item
In some cases, the backlinks may be sufficient as checklist.
2022-11-12 16:56:29 +01:00
bba3adef3d
No not print empty backlink table when inserting checklist
In case there are not backlinks, replace the empty backlink table with a simple
"none".  I think that's cleaner :)
2022-11-12 15:46:49 +01:00
d8c8e2b272
Do not backlinks in checklists when scheduled in the future
Items scheduled in the future are generally ignored, so let's do this in
checklists as well.
2022-11-12 11:50:53 +01:00
150b17c22b
Look up parent depth for backlinks in checklist via item property 2022-10-30 12:04:13 +01:00
c9dcc7778e
Use Org builtin function to format links in strings 2022-10-29 10:17:28 +02:00
0c84493abc
Do not include TEMPLATE in inserted checklists
References to item at point contained in templates are usually not meant to be
considered manually, but just to automatically insert backreferences.
2022-10-09 11:36:43 +02:00
754e22dc77
Update function name and docstring for Org template copy function
We are now not merely copying a template from another item, but more abstractly
insert a checklist consisting of backlinks and a template.  Update docstring and
function name to reflect that, but keep the old name of `db/org-copy-template`
as an obsolete alias.
2022-10-09 11:22:36 +02:00
564990a1af
Automatically add backlinks when copying templates
Experimental

Backlinks are an integral part of the checklist for the item at point, so why
not include them per default?

Copying is for now done unconditionally and without any customization.  If those
will turn out necessary, then they will be added later.
2022-10-09 10:25:39 +02:00
799f1be1f6
Remove obsolete template copying functions
Everything is now covered by `db/org-copy-template`.
2022-10-09 09:56:09 +02:00
7169a6b83e
Allow general org-read-date syntax in workload overview report
This is already allowed by the docstring, but now also supported by calling
`org-read-date` on the original inputs (if given).
2022-10-07 15:45:53 +02:00
047627c6ac
Allow no start date in workload overview report
This is different from the previous default start date of today, as now all past
items will also be considered.  Additionally, also include the start date (or
today, if not given) to be included in the result table to show all efforts
still left for that day.
2022-10-07 15:42:02 +02:00
bc3ab8b901
Fix template copy mechanism when template is in other buffer
Forgot to switch buffer when marker in other buffer is given.
2022-10-03 10:11:17 +02:00