fix(mu4e): org-msg: toggle behavior

Toggle behavior:

The `(integerp current-prefix-arg)` check didn't appropriately catch
`C-u`/`SPC u` prefixes. This attempts to use `(prefix-numeric-value
current-prefix-arg)` instead to normalize these cases.

Variable naming:

I'm not sure if this was supposed to continue to be called
`+mu4e-compose-org-msg-toggle-next` or if the rename to private
`+mu4e--compose-org-msg-toggle-next` was intentional and the usage
wasn't updated accordingly. I see the `mu4e` README still mentions it,
so I would guess the former and this was a typo.

Ref: #8073
Amend: a78237cc01
This commit is contained in:
Martin Myrseth
2024-10-03 06:45:35 +02:00
committed by GitHub
parent 68b3cc86c5
commit dc387bc486

View File

@ -442,14 +442,14 @@ This should already be the case yet it does not always seem to be."
(org-msg-set-prop "attachment" (nconc files (list file))))) (org-msg-set-prop "attachment" (nconc files (list file)))))
;; HACK: Toggle `org-msg' where sensible. ;; HACK: Toggle `org-msg' where sensible.
(defvar +mu4e--compose-org-msg-toggle-next t) (defvar +mu4e-compose-org-msg-toggle-next t)
(defadvice! +mu4e-maybe-toggle-org-msg-a (&rest _) (defadvice! +mu4e-maybe-toggle-org-msg-a (&rest _)
:before #'+mu4e/attach-files :before #'+mu4e/attach-files
:before #'mu4e-compose-new :before #'mu4e-compose-new
:before #'mu4e-compose-reply :before #'mu4e-compose-reply
:before #'mu4e-compose-forward :before #'mu4e-compose-forward
:before #'mu4e-compose-resend :before #'mu4e-compose-resend
(when (xor (/= 1 (if (integerp current-prefix-arg) current-prefix-arg 0)) (when (xor (/= 1 (prefix-numeric-value current-prefix-arg))
+mu4e-compose-org-msg-toggle-next) +mu4e-compose-org-msg-toggle-next)
(org-msg-mode (if org-msg-mode -1 1)) (org-msg-mode (if org-msg-mode -1 1))
(cl-callf not +mu4e-compose-org-msg-toggle-next))) (cl-callf not +mu4e-compose-org-msg-toggle-next)))