The default keybinding of org-todo is C-c
C-t. Today I learned about another command with a similar
keybinding (C-c C-x C-t) --
org-toggle-timestamp-overlays. Note the C-x
in the middle.
When I pressed that key combination (inadvertently), all the
YYYY-MM-DD timestamps in the buffer were converted to the MM/DD/YYYY
format. This was unacceptable -- I needed to change them back.
However undo did not revert the timestamps; it just undid
the last edit. Furthermore, these undesired timestamps couldn't be
edited and were impervious to org-shiftright. I was
confused yet again.
I didn't even know how this happened. So I
invoked view-lossage as a kind reader once suggested 1
and discovered org-toggle-timestamp-overlays.
The docstring was no help – it's self-evident that it would "Toggle the use of custom time stamp formats." Eager to clock out of my task, I didn't care to learn more. All I wanted to do was undo the effect.
I figured that since it toggles the timestamp, all I had to do was invoke it again to toggle it back. Nope. Well, a nice message appears, saying "Time stamp overlays removed." Yet the timestamps looked the same.
Undaunted, I figured I'd reload the buffer with org-mode-restart.
That had no effect. To finally fix this, I deleted the buffer and
revisited the file.
A command like this surely is in the same category as upcase-region,
which is disabled by default. And so this is why I added
(put 'org-toggle-timestamp-overlays 'disabled t) to my init file.
1 See https://ray-on-emacs.blogspot.com/2026/05/emacs-view-commands.html
Hi Ray, toggling works properly for me on emacs 30.2.
ReplyDeleteHi Ray, in my emacs 30.1 with org-mode 9.7.11 toggling the overlays back also didn't work. Luckily changing the timestamp overlay didn't change the original text, so my file still had the previous format. I tried in "emacs -Q" many things to remove the overlay, like (remove-overlays). Even "M-x revert-buffer" failed !? After Googling for halve an hour I got a fix: (with-silent-modifications (remove-text-properties (point-min) (point-max) '(display nil))). According to Google: The root of this problem stems from a major architectural overhaul introduced during the Org 9.7 release, combined with how Emacs 30 handles buffer modification notices. A related bug is https://lists.nongnu.org/archive/html/bug-gnu-emacs/2025-05/msg00203.html
ReplyDelete