From 82208fb5da4550b285e21494b2840ab61b0d6dfb Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 12 Mar 2021 03:23:21 +0000 Subject: (Emacs)+calendar section This just adds some functionality to calendar to copy dates and such. Also toggle function with binding. --- Emacs/.config/emacs/config.org | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'Emacs/.config') diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index d1d8983..8b61830 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -1097,6 +1097,33 @@ initial startup screen in default Emacs. "}" #'dashboard-next-section "{" #'dashboard-previous-section)) #+end_src +** Calendar +Calendar is a simple inbuilt application within Emacs that helps with +date functionalities. I add functionality to copy dates from the +calendar to the kill ring. +#+begin_src emacs-lisp +(use-package calendar + :straight nil + :defer t + :commands (+calendar/copy-date +calendar/toggle-calendar) + :general + (:map 'calendar-mode-map + :states '(normal motion) + "Y" #'+calendar/copy-date) + (leader + "ad" #'+calendar/toggle-calendar) + :config + (defun +calendar/copy-date () + "Copy date under cursor into kill ring." + (interactive) + (if (use-region-p) + (call-interactively #'kill-ring-save) + (let ((date (calendar-cursor-to-date))) + (when date + (setq date (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))) + (kill-new (format-time-string "%Y-%m-%d" date)))))) + (+dx/create-toggle-function +calendar/toggle-calendar "*Calendar*" #'calendar)) +#+end_src ** Mail *** Mail Preamble Mail is a funny thing; most people use it just for business or -- cgit v1.2.3-13-gbd6f