Last active
August 29, 2015 14:14
-
-
Save kanru/1a7c4dc58fda760b4bb4 to your computer and use it in GitHub Desktop.
yank-date-from-calendar.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- lexical-binding: t -*- | |
(defun yank-date-from-calendar () | |
(interactive) | |
(let ((date-string nil)) | |
(set-transient-map | |
(let ((map (make-sparse-keymap))) | |
(set-keymap-parent map calendar-mode-map) | |
(define-key map (kbd "RET") | |
(lambda () | |
(interactive) | |
(switch-to-buffer calendar-buffer) | |
(setf date-string | |
(calendar-date-string (calendar-cursor-to-date t))) | |
(calendar-exit) | |
(insert date-string))) | |
map) | |
(lambda () (null date-string))) | |
(save-excursion | |
(calendar)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment