]> git.ekhem.eu.org Git - guix.git/commitdiff
[emacs] Customize calender.
authorJakub Czajka <jakub@ekhem.eu.org>
Fri, 23 Dec 2022 16:38:05 +0000 (17:38 +0100)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:53:07 +0000 (19:53 +0100)
Caflw is an advanced calendar for emacs.

conf/home/emacs.scm
emacs/.config/emacs/conf/conf-calendar.el [new file with mode: 0644]

index 4458f58019711a0ceea2d489a0de6beda815a235..0b26c69207311b5ece4c1fb3fef3ec629bfc0631 100644 (file)
            (dotfiles
             (list "emacs/.config/emacs/conf/conf-batch-edit.el")))))
 
+(define emacs-calfw-service
+  (service home-program-service-type
+          (home-program-configuration
+           (packages
+            (list emacs-calfw))
+           (dotfiles
+            (list "emacs/.config/emacs/conf/conf-calendar.el")))))
+
 (define emacs-daemon-shepherd-service
   (shepherd-service
    (provision '(emacs))
@@ -59,6 +67,7 @@
 
 (define emacs-services
   (list emacs-batch-edit-service
+        emacs-calfw-service
        emacs-daemon-service
         emacs-package-service
         emacs-service))
diff --git a/emacs/.config/emacs/conf/conf-calendar.el b/emacs/.config/emacs/conf/conf-calendar.el
new file mode 100644 (file)
index 0000000..9dd20a4
--- /dev/null
@@ -0,0 +1,59 @@
+;; Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; conf-calendar.el - configuration for the calendar.
+
+(require 'conf-package)
+
+(use-package calfw
+  :requires
+  (conf-keys)
+  :ensure t
+  :bind
+  (:map cfw:calendar-mode-map
+       ("d" . cfw:navi-goto-date-command)
+       ("g" . cfw:refresh-calendar-buffer))
+  :custom
+  (calendar-holidays holiday-christian-holidays)
+  :config
+  (transient-define-prefix conf:calfw-transient ()
+    "Transient keymap with usefeul commands for `calfw'."
+    [["General"
+      ("t" "today" cfw:navi-goto-today-command)
+      ("d" "date" cfw:navi-goto-date-command)
+      ("g" "refresh" cfw:refresh-calendar-buffer)]
+     ["Day"
+      ("b" "previous" cfw:navi-previous-day-command)
+      ("f" "next" cfw:navi-next-day-command)]
+     ["Week"
+      ("p" "previous" cfw:navi-previous-week-command)
+      ("n" "next" cfw:navi-next-week-command)
+      ("^" "begin" cfw:navi-goto-week-begin-command)
+      ("$" "end" cfw:navi-goto-week-end-command)]
+     ["Month"
+      ("<" "previous" cfw:navi-previous-month-command)
+      (">" "next" cfw:navi-next-month-command)
+      ("[home]" "begin" cfw:navi-goto-first-date-command)
+      ("[end]" "end" cfw:navi-goto-last-date-command)]
+     ["View"
+      ("D" "day" cfw:change-view-day)
+      ("W" "one week" cfw:change-view-week)
+      ("T" "two weeks" cfw:change-view-two-weeks)
+      ("M" "month" cfw:change-view-month)]])
+  (define-key cfw:calendar-mode-map "?" '("transient" . conf:calfw-transient)))
+
+(use-package calfw-org
+  :requires
+  (conf-org)
+  :ensure t
+  :bind
+  ("C-c k" . conf:open-calendar)
+  :config
+  (defun conf:open-calendar ()
+    "Custom `calfw' calendar."
+    (interactive)
+    (require 'calfw)
+    (cfw:open-calendar-buffer
+     :contents-sources (list (cfw:org-create-source "Green")))))
+
+(provide 'conf-calendar)