aboutsummaryrefslogtreecommitdiff
path: root/Emacs/.config/emacs
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2021-03-12 03:23:21 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2021-03-12 03:25:58 +0000
commit82208fb5da4550b285e21494b2840ab61b0d6dfb (patch)
tree35a9a5fc0e5a4ab352a344f00e13e02dfa5e0987 /Emacs/.config/emacs
parent45266f64cc21a170ceed8cf807a624402366bfa1 (diff)
downloaddotfiles-82208fb5da4550b285e21494b2840ab61b0d6dfb.tar.gz
dotfiles-82208fb5da4550b285e21494b2840ab61b0d6dfb.tar.bz2
dotfiles-82208fb5da4550b285e21494b2840ab61b0d6dfb.zip
(Emacs)+calendar section
This just adds some functionality to calendar to copy dates and such. Also toggle function with binding.
Diffstat (limited to 'Emacs/.config/emacs')
-rw-r--r--Emacs/.config/emacs/config.org27
1 files changed, 27 insertions, 0 deletions
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