From b062fb98e3c50a5a6a8fab827eb5f9238017d4fb Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Wed, 28 Jan 2026 18:36:05 +0100 Subject: [PATCH] add org macro mdate --- settings/org-settings.el | 10 +++++++++- snippets/org-mode/article | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/settings/org-settings.el b/settings/org-settings.el index fc33d7d9..f7cf3bcf 100644 --- a/settings/org-settings.el +++ b/settings/org-settings.el @@ -1160,7 +1160,15 @@ except: ;; 'my-org-export-filter-hyphen-shy) (setq org-export-with-smart-quotes t) ;; OPTIONS keyword, e.g., "’:t". (setq org-export-with-sub-superscripts '{}) ;; OPTIONS keyword, e.g., "^:{}". - + + ;; see also https://orgmode.org/manual/Macro-Replacement.html + ;; #+date: {{{mdate(%e %B %Y\, %H:%M)}}} + (setq org-export-global-macros + '((mdate . "(eval (let () + (setq-local system-time-locale \"en_US.UTF-8\") + (format-time-string $1 (file-attribute-modification-time + (file-attributes (buffer-file-name))))))"))) + ;; http://permalink.gmane.org/gmane.emacs.orgmode/93971 ;; https://emacs.stackexchange.com/questions/30575/adding-latex-newpage-before-a-heading/30892 (defun my-org-headline-string-element (headline backend info) diff --git a/snippets/org-mode/article b/snippets/org-mode/article index 91f4e1ec..84adec20 100644 --- a/snippets/org-mode/article +++ b/snippets/org-mode/article @@ -6,7 +6,7 @@ # -*- ispell-local-dictionary: "english" -*- #+TITLE: ${1:Title} #+SUBTITLE: ${2:Subtitle} -#+DATE: ${3:{{{modification-time(%d.%m.%Y)}}}} +#+DATE: ${3:{{{mdate(%d %B %Y)}}}} #+AUTHOR: ${4:My Name} #+EMAIL: ${5:my.name@example.com} #+KEYWORDS: