diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -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. |
1521 | See help of `format-time-string' for alternative formats.") | 1521 | See 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. |
1533 | See help of `format-time-string' for alternative formats.") | 1531 | See 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 | ||