doomemacs/modules/app/calendar/autoload.el

46 lines
1.3 KiB
EmacsLisp
Raw Normal View History

;;; app/calendar/autoload.el -*- lexical-binding: t; -*-
2018-01-13 17:26:40 +08:00
;;;###autoload
(defun =calendar ()
"Activate (or switch to) `calendar' in its workspace."
(interactive)
(unless (featurep! :feature workspaces)
(user-error ":feature workspaces is required, but disabled"))
(+workspace-switch "Calendar" t)
(if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*cfw" (buffer-name (window-buffer it))))
(doom-visible-windows))))
(select-window (get-buffer-window buf)) (call-interactively +calendar-open-calendar-function))
2018-01-13 17:26:40 +08:00
(+workspace/display))
;;;###autoload
(defun +calendar/quit ()
2018-02-19 15:18:36 -05:00
"TODO"
2018-01-13 17:26:40 +08:00
(interactive)
(+workspace/delete "Calendar"))
;;;###autoload
(defun +calendar/open-calendar ()
2018-02-19 15:18:36 -05:00
"TODO"
2018-01-13 17:26:40 +08:00
(interactive)
(cfw:open-calendar-buffer
;; :custom-map cfw:my-cal-map
:contents-sources
(list
(cfw:org-create-source (doom-color 'fg)) ; orgmode source
)))
2018-02-19 15:18:36 -05:00
;;;###autoload
(defun +calendar*cfw:render-button (title command &optional state)
"render-button
TITLE
COMMAND
STATE"
(let ((text (concat " " title " "))
(keymap (make-sparse-keymap)))
(cfw:rt text (if state 'cfw:face-toolbar-button-on
'cfw:face-toolbar-button-off))
(define-key keymap [mouse-1] command)
(cfw:tp text 'keymap keymap)
(cfw:tp text 'mouse-face 'highlight)
text))