Skip to content

Instantly share code, notes, and snippets.

@kanru
Last active August 29, 2015 14:14
Show Gist options
  • Save kanru/1a7c4dc58fda760b4bb4 to your computer and use it in GitHub Desktop.
Save kanru/1a7c4dc58fda760b4bb4 to your computer and use it in GitHub Desktop.
yank-date-from-calendar.el
;; -*- 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