app/calendar: general refactor
This commit is contained in:
parent
4cd79bd6ca
commit
04cb9a2691
2 changed files with 46 additions and 34 deletions
|
@ -14,11 +14,13 @@
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +calendar/quit ()
|
(defun +calendar/quit ()
|
||||||
|
"TODO"
|
||||||
(interactive)
|
(interactive)
|
||||||
(+workspace/delete "Calendar"))
|
(+workspace/delete "Calendar"))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +calendar/open-calendar ()
|
(defun +calendar/open-calendar ()
|
||||||
|
"TODO"
|
||||||
(interactive)
|
(interactive)
|
||||||
(cfw:open-calendar-buffer
|
(cfw:open-calendar-buffer
|
||||||
;; :custom-map cfw:my-cal-map
|
;; :custom-map cfw:my-cal-map
|
||||||
|
@ -27,3 +29,17 @@
|
||||||
(cfw:org-create-source (doom-color 'fg)) ; orgmode source
|
(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))
|
||||||
|
|
|
@ -1,46 +1,40 @@
|
||||||
;;; app/calendar/config.el -*- lexical-binding: t; -*-
|
;;; app/calendar/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +calendar-org-gcal-secret-file "~/.emacs.d/modules/private/org/secret.el")
|
(defvar +calendar-org-gcal-secret-file
|
||||||
(defvar +calendar-open-calendar-function '+calendar/open-calendar)
|
(expand-file-name "private/org/secret.el" doom-modules-dir)
|
||||||
|
"TODO")
|
||||||
|
|
||||||
|
(defvar +calendar-open-calendar-function #'+calendar/open-calendar
|
||||||
|
"TODO")
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Plugins
|
||||||
|
;;
|
||||||
|
|
||||||
(def-package! calfw
|
(def-package! calfw
|
||||||
:commands (cfw:open-calendar-buffer)
|
:commands (cfw:open-calendar-buffer)
|
||||||
:config
|
:config
|
||||||
|
|
||||||
;; better frame for calendar
|
;; better frame for calendar
|
||||||
(setq
|
(setq cfw:face-item-separator-color nil
|
||||||
cfw:face-item-separator-color nil
|
cfw:render-line-breaker 'cfw:render-line-breaker-none
|
||||||
cfw:render-line-breaker 'cfw:render-line-breaker-none
|
cfw:fchar-junction ?╋
|
||||||
cfw:fchar-junction ?╋
|
cfw:fchar-vertical-line ?┃
|
||||||
cfw:fchar-vertical-line ?┃
|
cfw:fchar-horizontal-line ?━
|
||||||
cfw:fchar-horizontal-line ?━
|
cfw:fchar-left-junction ?┣
|
||||||
cfw:fchar-left-junction ?┣
|
cfw:fchar-right-junction ?┫
|
||||||
cfw:fchar-right-junction ?┫
|
cfw:fchar-top-junction ?┯
|
||||||
cfw:fchar-top-junction ?┯
|
cfw:fchar-top-left-corner ?┏
|
||||||
cfw:fchar-top-left-corner ?┏
|
cfw:fchar-top-right-corner ?┓)
|
||||||
cfw:fchar-top-right-corner ?┓)
|
|
||||||
|
|
||||||
|
(map! :map cfw:calendar-mode-map "q" #'+calendar/quit)
|
||||||
|
|
||||||
(defun cfw:render-button (title command &optional state)
|
(when (featurep 'solaire-mode)
|
||||||
"render-button
|
(add-hook 'cfw:calendar-mode-hook #'solaire-mode))
|
||||||
TITLE
|
(add-hook 'cfw:calendar-mode-hook 'doom-hide-modeline-mode)
|
||||||
COMMAND
|
|
||||||
STATE"
|
(advice-add #'cfw:render-button :override #'+calendar*cfw:render-button))
|
||||||
(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))
|
|
||||||
|
|
||||||
(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
|
(def-package! calfw-org
|
||||||
:commands (cfw:open-org-calendar
|
:commands (cfw:open-org-calendar
|
||||||
|
@ -48,6 +42,7 @@
|
||||||
cfw:open-org-calendar-withkevin
|
cfw:open-org-calendar-withkevin
|
||||||
my-open-calendar))
|
my-open-calendar))
|
||||||
|
|
||||||
|
|
||||||
(def-package! org-gcal
|
(def-package! org-gcal
|
||||||
:commands (org-gcal-sync
|
:commands (org-gcal-sync
|
||||||
org-gcal-fetch
|
org-gcal-fetch
|
||||||
|
@ -59,4 +54,5 @@
|
||||||
(defun org-gcal--notify (title mes)
|
(defun org-gcal--notify (title mes)
|
||||||
(message "org-gcal::%s - %s" title mes)))
|
(message "org-gcal::%s - %s" title mes)))
|
||||||
|
|
||||||
|
|
||||||
;; (def-package! alert)
|
;; (def-package! alert)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue