forked from mhkc/google-calendar-layer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packages.el
92 lines (77 loc) · 3.16 KB
/
packages.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
;;; packages.el --- google-calendar layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Markus Johansson <markus.johansson@me.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Commentary:
(defconst google-calendar-packages
'(org-gcal
calfw
calfw-org))
(defun google-calendar/init-org-gcal ()
"Initializes org-gcal and adds keybindings for it's exposed functions"
(use-package org-gcal
:init
(progn
(spacemacs/set-leader-keys
"aGr" 'org-gcal-request-token
"aGs" 'org-gcal-sync
"aGf" 'org-gcal-fetch))
:config
(add-hook 'after-init-hook 'org-gcal-fetch)
(add-hook 'kill-emacs-hook 'org-gcal-sync)
(add-hook 'org-agenda-mode-hook (lambda () (org-gcal-sync)))))
(defun google-calendar/init-calfw ()
"Initialize calfw"
(use-package calfw
:init
(evil-set-initial-state 'cfw:calendar-mode 'normal)
(defvar calfw-org-agenda-view "a"
"Key for opening the current week or day view in org-agenda.")
(defvar calfw-window-conf nil
"Current window config")
(defcustom calfw-restore-windows-after-quit 't
"Non-nil means restore window configuration upon exiting calfw calendar view.
The window configuration is stored when entering calendar view.
When the view is exited and this option is set the previous layout is restored."
:type 'boolean)
(defcustom calfw-calendar-window-setup 'only-window
"How the calfw calendar buffer should be displayed. This variable overrides org-agenda-window-setup.
Possible values for this option are:
current-window Show calendar in the current window, keeping all other windows.
other-window Use `switch-to-buffer-other-window' to display calendar.
only-window Show calendar, deleting all other windows.
reorganize-frame Show only two windows on the current frame, the current
window and the calendar.
other-frame Use `switch-to-buffer-other-frame' to display calendar.
Also, when exiting the calendar, kill that frame. "
:type '(choice
(const current-window)
(const other-frame)
(const other-window)
(const only-window)
(const reorganize-frame)))
:config
(evil-make-overriding-map cfw:calendar-mode-map)
(define-key cfw:calendar-mode-map "N" 'cfw:navi-next-month-command)
(define-key cfw:calendar-mode-map "P" 'cfw:navi-previous-month-command)
(define-key cfw:calendar-mode-map "c" 'cfw:org-capture)
(define-key cfw:calendar-mode-map "v" 'cfw:org-open-agenda-day)))
(defun google-calendar/init-calfw-org ()
"Initialize calfw-org"
(use-package calfw-org
:init
(spacemacs/set-leader-keys
"aGc" 'google-calendar/calfw-view)
(spacemacs/declare-prefix "aGc" "open-org-calendar")
(add-hook 'cfw:calendar-mode-hook (lambda () (org-gcal-sync)))
:config
(define-key cfw:org-schedule-map "q" 'google-calendar/calfw-restore-windows)
:commands
(cfw:open-org-calendar)))
;;; packages.el ends here