feat(notmuch): allow notmuch module without (:ui workspaces)

Remove the dependency of (:ui workspaces) from the notmuch module
This commit is contained in:
Hugo Nobrega 2021-09-30 11:54:11 -03:00 committed by Henrik Lissner
parent 645f5eae50
commit f394d9f65b

View file

@ -4,16 +4,16 @@
(defun =notmuch () (defun =notmuch ()
"Activate (or switch to) `notmuch' in its workspace." "Activate (or switch to) `notmuch' in its workspace."
(interactive) (interactive)
(unless (featurep! :ui workspaces)
(user-error ":ui workspaces is required, but disabled"))
(condition-case-unless-debug e (condition-case-unless-debug e
(progn (progn
(+workspace-switch "*MAIL*" t) (when (featurep! :ui workspaces)
(+workspace-switch "*MAIL*" t))
(if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*notmuch" (buffer-name (window-buffer it)))) (if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*notmuch" (buffer-name (window-buffer it))))
(doom-visible-windows)))) (doom-visible-windows))))
(select-window (get-buffer-window buf)) (select-window (get-buffer-window buf))
(funcall +notmuch-home-function)) (funcall +notmuch-home-function))
(+workspace/display)) (when (featurep! :ui workspaces)
(+workspace/display)))
('error ('error
(+notmuch/quit) (+notmuch/quit)
(signal (car e) (cdr e))))) (signal (car e) (cdr e)))))
@ -28,7 +28,8 @@
(interactive) (interactive)
;; (+popup/close (get-buffer-window "*notmuch-hello*")) ;; (+popup/close (get-buffer-window "*notmuch-hello*"))
(doom-kill-matching-buffers "^\\*notmuch") (doom-kill-matching-buffers "^\\*notmuch")
(+workspace/delete "*MAIL*")) (when (featurep! :ui workspaces)
(+workspace/delete "*MAIL*")))
(defun +notmuch-get-sync-command () (defun +notmuch-get-sync-command ()
"Return a shell command string to synchronize your notmuch mmail with." "Return a shell command string to synchronize your notmuch mmail with."