Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use org-time-stamp-format function to obtain the timestamp format #78

Merged
merged 1 commit into from Dec 13, 2022

Conversation

akirak
Copy link
Contributor

@akirak akirak commented Nov 18, 2022

The value of org-time-stamp-formats constant is going to be changed in Emacs 29: https://git.sr.ht/~bzg/org-mode/commit/e3a7c01874c9bb80e04ffa58c578619faf09e7f0

This can break the format of the backlink prefix as in the example below:

:BACKLINKS:
[Y-11-18 Fri 19:%] <- [[id:3bdc7eb2-afc4-4931-a6b1-b60953dc5813][Update on the change of org-time-stamp-formats]]
:END:

Rather than using the value of the variable directly, I would recommend you use `org-time-stamp-format' function to obtain the format. It now correctly renders as follows:

:BACKLINKS:
[2022-11-18 Fri 19:25] <- [[id:3bdc7eb2-afc4-4931-a6b1-b60953dc5813][Update on the change of org-time-stamp-formats]]
:END:

It's value is under a change in Emacs 29.
See https://git.sr.ht/~bzg/org-mode/commit/e3a7c01874c9bb80e04ffa58c578619faf09e7f0

Rather than use the value of the variable directly, it is better to use
`org-time-stamp-format' function to retrieve the format.
@stefan2904
Copy link

Test with fresh emacs 28.2 and org 9.5.5

% docker run -i -t org95 emacs --version
GNU Emacs 28.2
Copyright (C) 2022 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

upstream 0.4 tag

% docker run -i -t org95 emacs --script org-sl-test-04.el
Loading /etc/emacs/site-start.d/00debian.el (source)...

"Test for org version: 9.5.5"

"Test using upstream 0.4 tag:"

"org-time-stamp-formats: <%Y-%m-%d %a %H:%M>"

"substring: %Y-%m-%d %a %H:%M"

"org-super-links-link-prefix-timestamp: [2022-12-13 Tue 18:32] -> "

akirak fix-time-format branch

% docker run -i -t org95 emacs --script org-sl-test-fix.el
Loading /etc/emacs/site-start.d/00debian.el (source)...

"Test for org version: 9.5.5"

"Test using akirak fix-time-format branch:"

"org-time-stamp-formats: <%Y-%m-%d %a %H:%M>"

"substring: %Y-%m-%d %a %H:%M"

"org-super-links-link-prefix-timestamp: [2022-12-13 Tue 18:32] -> "

looks good

@stefan2904
Copy link

Test with fresh emacs 28.2 and org 9.6 from git

smore@t480ssm ~/projects/org-super-links-experiments % docker run -i -t org96 emacs --version
GNU Emacs 28.2
Copyright (C) 2022 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

upstream 0.4 tag

% docker run -i -t org96 emacs --script org-sl-test-04.el
Loading /etc/emacs/site-start.d/00debian.el (source)...

"Test for org version: 9.6"

"Test using upstream 0.4 tag:"

"org-time-stamp-formats: %Y-%m-%d %a %H:%M"

"substring: Y-%m-%d %a %H:%"

"org-super-links-link-prefix-timestamp: [Y-12-13 Tue 18:%] -> "

akirak fix-time-format branch

% docker run -i -t org96 emacs --script org-sl-test-fix.el
Loading /etc/emacs/site-start.d/00debian.el (source)...

"Test for org version: 9.6"

"Test using akirak fix-time-format branch:"

"org-time-stamp-formats: %Y-%m-%d %a %H:%M"

"substring: Y-%m-%d %a %H:%"

"org-super-links-link-prefix-timestamp: [2022-12-13 Tue 18:44] -> "

the fixed version looks also good

@stefan2904
Copy link

stefan2904 commented Dec 13, 2022

Since org-super-links-backlink-prefix-timestamp was also patched, I added it to the tests; works as expected. 👍

See here for the full output:
https://gist.github.com/stefan2904/85cff4c12a1e0e07e3ddd4a822711c39#gistcomment-4401436

@toshism
Copy link
Owner

toshism commented Dec 13, 2022

Excellent, LGTM! thanks @akirak and @stefan2904 !

@toshism toshism merged commit 0dd9ed2 into toshism:develop Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants