branch: externals/hyperbole
commit 7f3c337bc1c7fc41354a494a71c0e99d16cebbd6
Author: Mats Lidell <mats.lid...@lidells.se>
Commit: GitHub <nore...@github.com>

    Add before-save-hook for automating date updates to manual (#722)
---
 ChangeLog          |  4 ++++
 man/.dir-locals.el | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 40204b7ec1..9da3dc2520 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2025-04-28  Mats Lidell  <ma...@gnu.org>
+
+* man/.dir-locals.el: Add before-save-hook for automating date updates.
+
 2025-04-27  Mats Lidell  <ma...@gnu.org>
 
 * man/hyperbole.texi (Implicit Button Types): Add anchor to all ibtypes.
diff --git a/man/.dir-locals.el b/man/.dir-locals.el
new file mode 100644
index 0000000000..7643932b4d
--- /dev/null
+++ b/man/.dir-locals.el
@@ -0,0 +1,19 @@
+((texinfo-mode
+  . ((before-save-hook
+      . (lambda ()
+          (let ((day (format-time-string "%d" (current-time)))
+                (month (capitalize (format-time-string "%B" (current-time))))
+                (year (format-time-string "%Y" (current-time))))
+            (save-excursion
+              (goto-char (point-min))
+              (when (re-search-forward "\\(@set UPDATED [[:word:]]+, 
[[:digit:]]+\\)" nil t)
+                (replace-match (format "@set UPDATED %s, %s" month year) nil t 
nil nil))
+              (goto-char (point-min))
+              (when (re-search-forward "\\(@set UPDATED-MONTH [[:word:]]+ 
[[:digit:]]+\\)" nil t)
+                (replace-match (format "@set UPDATED-MONTH %s %s" month year) 
nil t nil nil))
+              (goto-char (point-min))
+              (when (re-search-forward "\\(Printed [[:word:]]+ [[:digit:]]+, 
[[:digit:]]+\.\\)" nil t)
+                (replace-match (format "Printed %s %s, %s." month day year) 
nil t nil nil))
+              (goto-char (point-min))
+              (when (re-search-forward "\\([[:word:]]+ [[:digit:]]+, 
[[:digit:]]+ @c AUTO-REPLACE-ON-SAVE\\)" nil t)
+                (replace-match (format "%s %s, %s @c AUTO-REPLACE-ON-SAVE" 
month day year) nil t nil nil)))))))))

Reply via email to