mu4e: avoid some compiler warnings

This commit is contained in:
Dirk-Jan C. Binnema 2023-01-04 12:16:30 +02:00
parent b1b11eb0cb
commit da02a954fa
2 changed files with 47 additions and 24 deletions

View File

@ -130,6 +130,22 @@ For example for bogofile, use \"/usr/bin/bogofilter -Sn < %s\"")
(push (buffer-name buffer) buffers))))
(nreverse buffers)))
;; backward compat until 27.1 is univeral.
(defalias 'mu4e--flatten-list
(if (fboundp 'flatten-list)
#'flatten-list
(with-no-warnings
#'eshell-flatten-list)))
;; backward compat ntil 28.1 is universal.
(defalias 'mu4e--mm-default-file-type
(if (fboundp 'mm-default-file-type)
#'mm-default-file-type
(with-no-warnings
#'mm-default-file-encoding)))
(defun eshell/mu4e-attach (&rest args)
"Attach files to a mu4e message using eshell with ARGS.
If no mu4e buffers found, compose a new message and then attach
@ -144,7 +160,7 @@ the file."
(file-directory-p f))
nil
(expand-file-name f)))
(eshell-flatten-list (reverse args))))))
(mu4e--flatten-list (reverse args))))))
;; warn if user tries to attach without any files marked
(if (null files-to-attach)
(error "No files to attach")
@ -173,7 +189,7 @@ the file."
(goto-char (point-max)) ; attach at end of buffer
(while files-to-attach
(mml-attach-file (car files-to-attach)
(or (mm-default-file-encoding
(or (mu4e--mm-default-file-type
(car files-to-attach))
"application/octet-stream") nil)
(setq files-to-attach (cdr files-to-attach)))

View File

@ -61,10 +61,17 @@ Example usage:
If non-nil, `org-store-link' in `mu4e-headers-mode' links to the
the current query; otherwise, it links to the message at point.")
;; backward compat until org >= 9.3 is univeral.
(defalias 'mu4e--org-link-store-props
(if (fboundp 'org-link-store-props)
#'org-link-store-props
(with-no-warnings
#'org-store-link-props)))
(defun mu4e--org-store-link-query ()
"Store a link to a mu4e query."
(setq org-store-link-plist nil) ; reset
(org-store-link-props
(mu4e--org-link-store-props
:type "mu4e"
:query (mu4e-last-query)
:date (format-time-string "%FT%T") ;; avoid error
@ -95,7 +102,7 @@ the current query; otherwise, it links to the message at point.")
(mu4e-contact-email to)) ;; mu4e-specific
:link ,(concat "mu4e:msgid:" msgid)
:description ,(funcall mu4e-org-link-desc-func msg))))
(apply #'org-store-link-props props)))
(apply #'mu4e--org-link-store-props props)))
(defun mu4e-org-store-link ()
"Store a link to a mu4e message or query.