aboutsummaryrefslogtreecommitdiff
path: root/Doom/.config/doom/modules/private/mail/autoload.el
blob: 13a79f934364e0bf26dc9c99110d12bbde5fb43d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
;;; private/mail/autoload.el -*- lexical-binding: t; -*-

;;;###autoload
(defun +mail/open-mail ()
  "Activate (or switch to) `notmuch' in its workspace."
  (interactive)
  (unless (featurep! :ui workspaces)
    (user-error ":ui workspaces is required, but disabled"))
  (condition-case-unless-debug e
      (progn
        (+workspace-switch "*MAIL*" t)
        (if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*notmuch" (buffer-name (window-buffer it))))
                                   (doom-visible-windows))))
            (select-window (get-buffer-window buf))
          (notmuch-search "tag:inbox"))
        (+workspace/display))
    ('error
     (+notmuch/quit)
     (signal (car e) (cdr e)))))