org-super-links produces broken timestamps in drawers
novoid opened this issue · 4 comments
Hi,
In my setup running org-super-links-20200611.155018
I get broken time-stamp properties when invoking sl-quick-insert-inline-link
:
*** FIXXME78: from
:PROPERTIES:
:CREATED: [2023-12-13 Wed 11:19]
:ID: 2023-12-13-FIXXME78-from
:END:
[[id:2023-12-13-FIXXME79-to][FIXXME79: to]]
*** FIXXME79: to
:PROPERTIES:
:CREATED: [2023-12-13 Wed 11:19]
:ID: 2023-12-13-FIXXME79-to
:END:
:LINKS:
[Y-12-13 Wed 11:%] <- [[id:2023-12-13-FIXXME78-from][FIXXME78: from]]
:END:
Notice the [Y-12-13 Wed 11:%]
timestamp when I add a link within "FIXXME78: from".
I was able to follow the code. The culprit is sl-backlink-prefix-timestamp
with the line:
(let* ((time-format (substring (cdr org-time-stamp-formats) 1 -1))
It works when changed to:
(let* ((time-format (cdr org-time-stamp-formats)) ;; no need for "substring" any more
Please do think of fixing that bug and maybe publish a new release.
My org-super-links setup in case it helps:
(use-package org-super-links
:quelpa (org-super-links :repo "toshism/org-super-links" :fetcher github :commit "develop")
:after helm-org
:bind (("C-c s s" . sl-link)
("C-c s l" . sl-store-link)
("C-c s C-l" . sl-insert-link) ;; inserts links to heading title (not property ID)
("C-c s d" . sl-quick-insert-drawer-link)
("C-c s i" . sl-quick-insert-inline-link))
:config
(setq sl-related-into-drawer t
sl-link-prefix 'sl-link-prefix-timestamp)
;; use my custom function to generate ID properties accordin to https://karl-voit.at/2019/11/16/UOMF-Linking-Headings/
(add-hook 'sl-pre-link-hook 'my-id-get-or-generate)
(add-hook 'sl-pre-backlink-hook 'my-id-get-or-generate)
;; Formats link descriptions as suggested on: https://github.com/toshism/org-super-links#limit-length-of-link-description
;; development: id:2020-08-05-implement-filter-function
(defun my-org-super-links-filter-description (link desc)
;; replace double bracket links with their description
(replace-regexp-in-string org-link-bracket-re "\\2"
;; removes: <2020-08-04 Tue>--<2020-08-04 Tue 23:37> (2nd time/date-stamp is optional; including inactive variants)
(replace-regexp-in-string org-element--timestamp-regexp ""
;; removes priority indicators such as [#A]
(replace-regexp-in-string org-priority-regexp ""
;; removes statistic cookies with absolute numbers such as [2/5]
(replace-regexp-in-string " ?\\[[0-9]+/[0-9]+\\]" ""
;; removes statistic cookies with percentages such as [33%]
(replace-regexp-in-string " ?\\[[0-9]+%\\]" "" desc)
))))
)
(setq sl-default-description-formatter 'my-org-super-links-filter-description)
(setq sl-backlink-into-drawer "LINKS"
sl-related-into-drawer "LINKS") ;; according to https://github.com/toshism/org-super-links/issues/33#issuecomment-678815869
)
Hi, code was fixed a year ago commit. Consider running quelpa-upgrade
from time to time; it is not automatically updated with package.el
, especially if you follow a branch and not a specific commit (here develop
is the main branch even though quelpa calls the keyword :commit).
OMG, yes - it's my first and only quelpa package and I obviously didn't notice that.
OK, I need to learn about quelpa and its update methods. Maybe switch from quelpa to raw git which I know how to handle. Sorry for the fuzz.
Quelpa keeps git projects in a folder and copies the elisp files to the regular elpa
folder. Running quelpa-upgrade
is doing git pull
and refreshing the files. Also, quelpa requires quelpa-checkout-melpa
from time to time since formulas are based on a local clone of the melpa project and formulas are added and changed. Quelpa supports the melpa recipe format, which you lose if you run your own git project with :load-path
; it has support for commits, branches, files to ignore, support for most forges (github,gitlab,codeberg,sourcehut). Just my 2c.
FYI: Upgrade from 0.2 to 0.4 worked like a charm after search/replace of the changed prefix. This issue is also fixed in 0.4 as mentioned above.