Skip to content

Commit

Permalink
refactor(mu4e): make use of +define-dedicated-workspace!
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Jun 14, 2023
1 parent 4887558 commit 2ecc219
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
25 changes: 0 additions & 25 deletions modules/extras/me-mu4e-extras.el
Original file line number Diff line number Diff line change
Expand Up @@ -277,31 +277,6 @@ If SKIP-HEADERS is set, do not show include message headers."
(+save-as-pdf outfile t))))
(mm-destroy-parts parts)))))

(defvar +mu4e-tab-name "*mu4e*"
"The name of the workspace dedicated to `mu4e'.
Set to nil to disable creating the dedicated workspace.")

;;;###autoload
(defun +mu4e ()
"Start `mu4e' in a dedicated workspace using `tabspaces' or `tab-bar'."
(interactive)
(when +mu4e-tab-name
(if (fboundp 'tabspaces-mode)
(tabspaces-switch-or-create-workspace +mu4e-tab-name)
(tab-new)
(tab-rename +mu4e-tab-name)))
(mu4e))

(defun +mu4e-close-workspace-when-stopped-setup ()
(advice-add
'mu4e-quit :after
(defun +mu4e--close-workspace-when-stopped-a ()
(if (fboundp 'tabspaces-mode)
(when-let ((tab-num (seq-position (tabspaces--list-tabspaces) +mu4e-tab-name #'string=)))
(tabspaces-close-workspace (1+ tab-num)))
(when-let ((tab-num (seq-position (tab-bar-tabs) +mu4e-tab-name (lambda (tab name) (string= name (alist-get 'name tab))))))
(tab-close (1+ tab-num)))))))

;;;###autoload
(defun +mu4e-extras-setup ()
(add-hook 'mu4e-compose-mode-hook '+mu4e--auto-bcc-h)
Expand Down
3 changes: 1 addition & 2 deletions modules/me-email.el
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
:after mu4e
:demand t
:init
(+define-dedicated-workspace! mu4e :exit-func mu4e-quit)
(+map! "om" #'+mu4e)
:config
;; Enable MinEmacs's mu4e extra features, including:
Expand All @@ -132,8 +133,6 @@
;; - Add an action to save all the attachements;
;; - Add an action to save the message at point.
(+mu4e-extras-setup)
;; Register an advice to remove the dedicated workspace after quitting `mu4e'
(+mu4e-close-workspace-when-stopped-setup)
;; Redefine bookmarks queries to ignore spams
(+mu4e-extras-ignore-spams-in-bookmarks-setup))

Expand Down

0 comments on commit 2ecc219

Please sign in to comment.