Skip to content

Commit 72b8c64

Browse files
authored
[mu4e] Catch errors when loading org (#16953)
An error within `(with-eval-after-load 'org ...)` has severe consequences: Org fails to load, and also help buffers cannot be opened at all, due to the elisp-demos package requiring org.
1 parent a3e6ea0 commit 72b8c64

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

layers/+email/mu4e/packages.el

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,22 @@ See https://github.com/syl20bnr/spacemacs/issues/16931#issuecomment-2767608202."
155155
(defun mu4e/pre-init-org ()
156156
(when mu4e-org-link-support
157157
(with-eval-after-load 'org
158-
;; This is a dirty hack due to mu(4e) 1.8.2 renaming mu4e-meta to
159-
;; mu4e-config. See also
160-
;; https://github.com/djcb/mu/commit/cf0f72e4a48ac7029d7f6758b182d4bb559f8f49
161-
;; and https://github.com/syl20bnr/spacemacs/issues/15618. This code
162-
;; used to simply read: (require 'mu4e-meta). We now attempt to load
163-
;; mu4e-config. If this fails, load mu4e-meta.
164-
(unless (require 'mu4e-config nil t)
165-
(require 'mu4e-meta))
166-
(if (version<= mu4e-mu-version "1.3.5")
167-
(require 'org-mu4e)
168-
(require 'mu4e-org))
169-
;; We require mu4e due to an existing bug https://github.com/djcb/mu/issues/1829
170-
;; Note that this bug prevents lazy-loading.
171-
(when (version<= mu4e-mu-version "1.4.15")
172-
(require 'mu4e))))
158+
(with-demoted-errors "(Spacemacs) Error loading a mu4e feature: %S"
159+
;; This is a dirty hack due to mu(4e) 1.8.2 renaming mu4e-meta to
160+
;; mu4e-config. See also
161+
;; https://github.com/djcb/mu/commit/cf0f72e4a48ac7029d7f6758b182d4bb559f8f49
162+
;; and https://github.com/syl20bnr/spacemacs/issues/15618. This code
163+
;; used to simply read: (require 'mu4e-meta). We now attempt to load
164+
;; mu4e-config. If this fails, load mu4e-meta.
165+
(unless (require 'mu4e-config nil t)
166+
(require 'mu4e-meta))
167+
(if (version<= mu4e-mu-version "1.3.5")
168+
(require 'org-mu4e)
169+
(require 'mu4e-org))
170+
;; We require mu4e due to an existing bug https://github.com/djcb/mu/issues/1829
171+
;; Note that this bug prevents lazy-loading.
172+
(when (version<= mu4e-mu-version "1.4.15")
173+
(require 'mu4e)))))
173174
(when mu4e-org-compose-support
174175
(spacemacs/set-leader-keys-for-major-mode 'mu4e-compose-mode
175176
"o" 'org-mu4e-compose-org-mode)

0 commit comments

Comments
 (0)