Initial commit

This commit is contained in:
2026-03-26 01:01:07 -07:00
commit 69a08dfc88

46
insert-datetime-el.el Normal file
View File

@@ -0,0 +1,46 @@
;;; Provide functions for inserting formatted time/date.
(require 'dash)
(defgroup insert-datetime nil
"You can modify Insert Datetime format strings here. See: `format-time-string'."
:group 'tools)
;;; Bart Simpson anti-chalkboard technique.
(let ((list '(("datetime" "%X")
("date" "%F")
("time" "%r")
("year" "%Y")
("month" "%m")
("week" "%U")
("day" "%e")
("day-of-year" "%j")
("day-of-month" "%d")
("day-of-week" "%A")
("hour" "%H")
("minute" "%M")
("second" "%S")
))
(custom-proto
"(defcustom insert-datetime-format-%s \"%s\"
\"Format string for \`insert-%s\'.\"
:group 'insert-datetime)")
(defun-proto
"(defun insert-%s ()
\"Insert %s at point.\"
(interactive)
(insert
(format-time-string
insert-datetime-format-%s (current-time))))"))
(--map
(eval
(read
(format custom-proto (car it) (cadr it) (car it))))
list)
(--map
(eval
(read
(format defun-proto (car it) (cadr it) (car it))))
list) )
(provide 'insert-datetime)