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; -*- ;;; 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 ;;;###autoload
(defun =calendar () (defun =calendar ()
"Activate (or switch to) `calendar' in its workspace." "Activate (or switch to) `calendar' in its workspace."
(interactive) (interactive)
(unless (featurep! :feature workspaces) (if (featurep! :feature workspaces)
(user-error ":feature workspaces is required, but disabled")) (progn
(+workspace-switch "Calendar" t) (+workspace-switch "Calendar" t)
(if-let* ((win (cl-loop for win in (doom-visible-windows) (+calendar--init)
if (string-match-p "^\\*cfw" (buffer-name (window-buffer it))) (+workspace/display))
return win))) (setq +calendar--wconf (current-window-configuration))
(select-window win) (delete-other-windows)
(call-interactively +calendar-open-function)) (+calendar--init)))
(+workspace/display))
;;;###autoload ;;;###autoload
(defun +calendar/quit () (defun +calendar/quit ()
"TODO" "TODO"
(interactive) (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 ;;;###autoload
(defun +calendar/open-calendar () (defun +calendar/open-calendar ()