aboutsummaryrefslogtreecommitdiff
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el32
1 files changed, 25 insertions, 7 deletions
diff --git a/init.el b/init.el
index 4715660..258f65e 100644
--- a/init.el
+++ b/init.el
@@ -1324,18 +1324,36 @@
1324;; --------------------------------- 1324;; ---------------------------------
1325;; Insert date/time at POINT 1325;; Insert date/time at POINT
1326;; ------------------------- 1326;; -------------------------
1327;; [YYYY-MM-DD HH:mm] 1327;; Keybinds to quickly insert
1328;; date/time at point in the correct
1329;; format.
1328;; --------------------------------- 1330;; ---------------------------------
1329 1331
1330(defvar mm/date-time-format "[%Y-%m-%d %a %H:%M]" 1332;; Active timestamp
1331 "Format of the date to insert with `mm/insert-date-time' function. See help of `format-time-string' for alternative formats.") 1333(defvar mm/date-time-format-active "<%Y-%m-%d %a %H:%M>"
1334 "Active date/time format for `mm/insert-date-time-active' function.
1335See help of `format-time-string' for alternative formats.")
1332 1336
1333(defun mm/insert-date-time () 1337(defun mm/insert-date-time-active ()
1334 "Insert the current date time in the format of `mm/date-time-format' at POINT." 1338 "Insert active timestamp at POINT in the format of `mm/date-time-format-active'."
1335 (interactive) 1339 (interactive)
1336 (insert (format-time-string mm/date-time-format (current-time)))) 1340 (insert (format-time-string mm/date-time-format-active (current-time))))
1341
1342(global-set-key (kbd "C-c i D") (lambda () (interactive) (mm/insert-date-time-active)))
1343
1344;; Inactive timestamp
1345(defvar mm/date-time-format-inactive "[%Y-%m-%d %a %H:%M]"
1346 "Inactive timestamp format for `mm/insert-date-time-inactive' function.
1347See help of `format-time-string' for alternative formats.")
1348
1349(defun mm/insert-date-time-inactive ()
1350 "Insert inactive timestamp at POINT in the format of `mm/date-time-format-inactive'."
1351 (interactive)
1352 (insert (format-time-string mm/date-time-format-inactive (current-time))))
1353
1354(global-set-key (kbd "C-c i d") (lambda () (interactive) (mm/insert-date-time-inactive)))
1355
1337 1356
1338(global-set-key (kbd "C-c i d") (lambda () (interactive) (mm/insert-date-time)))
1339 1357
1340 1358
1341;; --------------------------------- 1359;; ---------------------------------