app/calendar: general refactor

This commit is contained in:
Henrik Lissner 2018-02-19 15:18:36 -05:00
parent 4cd79bd6ca
commit 04cb9a2691
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 46 additions and 34 deletions

View file

@ -14,11 +14,13 @@
;;;###autoload
(defun +calendar/quit ()
"TODO"
(interactive)
(+workspace/delete "Calendar"))
;;;###autoload
(defun +calendar/open-calendar ()
"TODO"
(interactive)
(cfw:open-calendar-buffer
;; :custom-map cfw:my-cal-map
@ -27,3 +29,17 @@
(cfw:org-create-source (doom-color 'fg)) ; orgmode source
)))
;;;###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))

View file

@ -1,14 +1,22 @@
;;; app/calendar/config.el -*- lexical-binding: t; -*-
(defvar +calendar-org-gcal-secret-file "~/.emacs.d/modules/private/org/secret.el")
(defvar +calendar-open-calendar-function '+calendar/open-calendar)
(defvar +calendar-org-gcal-secret-file
(expand-file-name "private/org/secret.el" doom-modules-dir)
"TODO")
(defvar +calendar-open-calendar-function #'+calendar/open-calendar
"TODO")
;;
;; Plugins
;;
(def-package! calfw
:commands (cfw:open-calendar-buffer)
:config
;; better frame for calendar
(setq
cfw:face-item-separator-color nil
(setq cfw:face-item-separator-color nil
cfw:render-line-breaker 'cfw:render-line-breaker-none
cfw:fchar-junction ?╋
cfw:fchar-vertical-line ?┃
@ -19,28 +27,14 @@
cfw:fchar-top-left-corner ?┏
cfw:fchar-top-right-corner ?┓)
(map! :map cfw:calendar-mode-map "q" #'+calendar/quit)
(defun 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))
(when (featurep 'solaire-mode)
(add-hook 'cfw:calendar-mode-hook #'solaire-mode))
(add-hook 'cfw:calendar-mode-hook 'doom-hide-modeline-mode)
(advice-add #'cfw:render-button :override #'+calendar*cfw:render-button))
(map! :map cfw:calendar-mode-map
"q" #'+calendar/quit)
(add-hook! 'cfw:calendar-mode-hook (solaire-mode +1)
(doom-hide-modeline-mode))
(map!
:map cfw:calendar-mode-map
"q" #'+calendar/quit))
(def-package! calfw-org
:commands (cfw:open-org-calendar
@ -48,6 +42,7 @@
cfw:open-org-calendar-withkevin
my-open-calendar))
(def-package! org-gcal
:commands (org-gcal-sync
org-gcal-fetch
@ -59,4 +54,5 @@
(defun org-gcal--notify (title mes)
(message "org-gcal::%s - %s" title mes)))
;; (def-package! alert)