app/calendar: don't require :feature workspaces

This commit is contained in:
Henrik Lissner 2018-04-02 05:49:55 -04:00
parent 21da187361
commit f6f2c92373
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -1,24 +1,36 @@
;;; app/calendar/autoload.el -*- lexical-binding: t; -*-
(defvar +calendar--wconf nil)
(defun +calendar--init ()
(if-let* ((win (cl-loop for win in (doom-visible-windows)
if (string-match-p "^\\*cfw:" (buffer-name (window-buffer it)))
return win)))
(select-window win)
(call-interactively +calendar-open-function)))
;;;###autoload
(defun =calendar ()
"Activate (or switch to) `calendar' in its workspace."
(interactive)
(unless (featurep! :feature workspaces)
(user-error ":feature workspaces is required, but disabled"))
(if (featurep! :feature workspaces)
(progn
(+workspace-switch "Calendar" t)
(if-let* ((win (cl-loop for win in (doom-visible-windows)
if (string-match-p "^\\*cfw" (buffer-name (window-buffer it)))
return win)))
(select-window win)
(call-interactively +calendar-open-function))
(+calendar--init)
(+workspace/display))
(setq +calendar--wconf (current-window-configuration))
(delete-other-windows)
(+calendar--init)))
;;;###autoload
(defun +calendar/quit ()
"TODO"
(interactive)
(+workspace/delete "Calendar"))
(if (featurep! :feature workspaces)
(+workspace/delete "Calendar")
(doom-kill-matching-buffers "^\\*cfw:")
(set-window-configuration +calendar--wconf)
(setq +calendar--wconf nil)))
;;;###autoload
(defun +calendar/open-calendar ()