Created
September 7, 2022 14:03
-
-
Save Khoulaiz/84f44aae7623113a98ed0489b5c7b80d to your computer and use it in GitHub Desktop.
Emacs Org-Mode: Inserts a timestamp into an exported org-file for the time of the export. Original org-file is untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; in your init.el | |
(defun ace/org-export-insert-export-date(&optional backend) | |
"Searches for %%DATE_EXPORTED%% in the buffer and replaces all occurrences | |
Just put the keyword somewhere in your org buffer and the time stamp of the | |
export is inserted in the exported buffer. The original buffer is untouched." | |
(goto-char (point-min)) | |
(while (search-forward "%%DATE_EXPORTED%%" nil t) | |
(replace-match (format-time-string "%0e.%0m.%Y %R")))) | |
;; after org-mode was loaded | |
(add-hook 'org-export-before-parsing-hook 'ace/org-export-insert-export-date) | |
;; rest of your init.el |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment