aboutsummaryrefslogtreecommitdiff
path: root/init.el
diff options
context:
space:
mode:
authorMountain Man <43313373+MountainMan1312@users.noreply.github.com>2023-07-23 20:08:48 -0400
committerMountain Man <43313373+MountainMan1312@users.noreply.github.com>2023-07-23 20:08:48 -0400
commit2e644dfb1bf83564fe48be3271df4d7f1324281c (patch)
tree8d1771decd6579da8c0cdcc5bf5a2290d4146ba7 /init.el
parentFix `org-agenda-files` usage of wildcards (diff)
downloadmmosmacs-2e644dfb1bf83564fe48be3271df4d7f1324281c.tar.gz
mmosmacs-2e644dfb1bf83564fe48be3271df4d7f1324281c.tar.bz2
mmosmacs-2e644dfb1bf83564fe48be3271df4d7f1324281c.zip
Add keybinds to insert date and time without org formatting
Diffstat (limited to 'init.el')
-rw-r--r--init.el25
1 files changed, 19 insertions, 6 deletions
diff --git a/init.el b/init.el
index 35857c4..d8f8d9e 100644
--- a/init.el
+++ b/init.el
@@ -1515,30 +1515,43 @@
1515;; format. 1515;; format.
1516;; --------------------------------- 1516;; ---------------------------------
1517 1517
1518;; Active timestamp 1518;; Insert active timestamp
1519(defvar mm/date-time-format-active "<%Y-%m-%d %a %H:%M>" 1519(defvar mm/date-time-format-active "<%Y-%m-%d %a %H:%M>"
1520 "Active date/time format for `mm/insert-date-time-active' function. 1520 "Active date/time format for `mm/insert-date-time-active' function.
1521See help of `format-time-string' for alternative formats.") 1521See help of `format-time-string' for alternative formats.")
1522
1523(defun mm/insert-date-time-active () 1522(defun mm/insert-date-time-active ()
1524 "Insert active timestamp at POINT in the format of `mm/date-time-format-active'." 1523 "Insert active timestamp at POINT in the format of `mm/date-time-format-active'."
1525 (interactive) 1524 (interactive)
1526 (insert (format-time-string mm/date-time-format-active (current-time)))) 1525 (insert (format-time-string mm/date-time-format-active (current-time))))
1527
1528(global-set-key (kbd "C-c i D") (lambda () (interactive) (mm/insert-date-time-active))) 1526(global-set-key (kbd "C-c i D") (lambda () (interactive) (mm/insert-date-time-active)))
1529 1527
1530;; Inactive timestamp 1528;; Insert inactive timestamp
1531(defvar mm/date-time-format-inactive "[%Y-%m-%d %a %H:%M]" 1529(defvar mm/date-time-format-inactive "[%Y-%m-%d %a %H:%M]"
1532 "Inactive timestamp format for `mm/insert-date-time-inactive' function. 1530 "Inactive timestamp format for `mm/insert-date-time-inactive' function.
1533See help of `format-time-string' for alternative formats.") 1531See help of `format-time-string' for alternative formats.")
1534
1535(defun mm/insert-date-time-inactive () 1532(defun mm/insert-date-time-inactive ()
1536 "Insert inactive timestamp at POINT in the format of `mm/date-time-format-inactive'." 1533 "Insert inactive timestamp at POINT in the format of `mm/date-time-format-inactive'."
1537 (interactive) 1534 (interactive)
1538 (insert (format-time-string mm/date-time-format-inactive (current-time)))) 1535 (insert (format-time-string mm/date-time-format-inactive (current-time))))
1539
1540(global-set-key (kbd "C-c i d") (lambda () (interactive) (mm/insert-date-time-inactive))) 1536(global-set-key (kbd "C-c i d") (lambda () (interactive) (mm/insert-date-time-inactive)))
1541 1537
1538;; Insert current date with no formatting
1539(defvar mm/date-format "%Y-%m-%d"
1540 "Date format for `mm/insert-date-string'.")
1541(defun mm/insert-date-string ()
1542 "Insert date at POINT in the format of `mm/date-format'."
1543 (interactive)
1544 (insert (format-time-string mm/date-format (current-time))))
1545(global-set-key (kbd "C-c i C-u D") (lambda () (interactive) (mm/insert-date-string)))
1546
1547;; Insert current time with no formatting
1548(defvar mm/time-format "%H:%M"
1549 "Time format for `mm/insert-time-string'.")
1550(defun mm/insert-time-string ()
1551 "Insert time at POINT in the format of `mm/time-format'."
1552 (interactive)
1553 (insert (format-time-string mm/time-format (current-time))))
1554(global-set-key (kbd "C-c i t") (lambda () (interactive) (mm/insert-time-string)))
1542 1555
1543 1556
1544 1557