Skip to content

link-prefix-timestamp broken (since org 9.6) #79

@stefan2904

Description

@stefan2904

Hi there!

After upgrading to the newest org-mode, I noticed that backlinks and related-links are broken:

:RELATED:
[Y-12-12 Mon 22:%] -> [[id:ef059713-6771-460f-a405-de0a0b571854][Fix orgmode ...]]
:END:
:BACKLINKS:
[Y-12-12 Mon 22:%] <- [[id:ef059713-6771-460f-a405-de0a0b571854][Fix orgmode ...]]
:END:

I did some digging, and I think I figured out why:

The org-sl function responsible for creating the prefix is org-super-links-link-prefix-timestamp, so if we run that one directly we can reproduce the result (for convenience I copied the function):

(defun org-super-links-link-prefix-timestamp ()
  "Return the default prefix string for a backlink.
Inactive timestamp formatted according to `org-time-stamp-formats' and
a separator ' -> '."
  (let* ((time-format (substring (cdr org-time-stamp-formats) 1 -1))
	 (time-stamp (format-time-string time-format (current-time))))
    (format "[%s] -> "
	    time-stamp)))

(org-super-links-link-prefix-timestamp)

#+RESULTS:
: [Y-12-12 Mon 22:%] ->

The issue is that it does a substring on (the first value of) org-time-stamp-formats. I guess this was to remove the leading/trailing <> sign. In a org commit (which is part of org 9.6) the value of org-time-stamp-formats was changed, stripping leading "<" and trailing ">". So instead, your function is now removing the first and last character of the format-string:

(substring (cdr org-time-stamp-formats) 1 -1)

#+RESULTS:
: Y-%m-%d %a %H:%

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions