Remove statistics cookies from Org links

Those cookies are correct when the link is inserted, but subsequently
gets updated (usually to `[0/0]`) when the statistics cookie is updated
in the Org item where the link is placed — removing any meaning from
this cookie.  It's thus better to not have it at all, I think.
This commit is contained in:
Daniel Borchmann 2024-04-30 08:30:07 +02:00
parent 85a6366550
commit 207d9f8c39
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625

18
init.el
View File

@ -865,7 +865,23 @@
(member x org-stored-links--new)) (member x org-stored-links--new))
org-stored-links--original)))) org-stored-links--original))))
org-store-link--return-value)))) org-store-link--return-value))
(define-advice org-link-make-string (:around
(orig-func link &optional description)
db/org--remove-statistics-cookie-from-link-descriptions)
"Remove statistics cookies from link descriptions.
Such cookies get updated with other statistics cookies and
quickly loose their meaning."
(funcall orig-func
link
(when description
;; Taken from `org--get-outline-path-1':
(org-trim
(replace-regexp-in-string
"\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" ""
description)))))))
(use-package ol-bbdb (use-package ol-bbdb
:config (add-to-list 'org-bbdb-anniversary-format-alist :config (add-to-list 'org-bbdb-anniversary-format-alist