mirror of https://github.com/djcb/mu.git
mu4e: avoid some compiler warnings
This commit is contained in:
parent
b1b11eb0cb
commit
da02a954fa
|
@ -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
|
||||
|
@ -141,10 +157,10 @@ the file."
|
|||
(files-to-attach
|
||||
(delq nil (mapcar
|
||||
(lambda (f) (if (or (not (file-exists-p f))
|
||||
(file-directory-p f))
|
||||
nil
|
||||
(expand-file-name f)))
|
||||
(eshell-flatten-list (reverse args))))))
|
||||
(file-directory-p f))
|
||||
nil
|
||||
(expand-file-name f)))
|
||||
(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,8 +189,8 @@ 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
|
||||
(car files-to-attach))
|
||||
(or (mu4e--mm-default-file-type
|
||||
(car files-to-attach))
|
||||
"application/octet-stream") nil)
|
||||
(setq files-to-attach (cdr files-to-attach)))
|
||||
(message "Attached file(s) %s" files-str))
|
||||
|
|
|
@ -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
|
||||
(setq org-store-link-plist nil) ; reset
|
||||
(mu4e--org-link-store-props
|
||||
:type "mu4e"
|
||||
:query (mu4e-last-query)
|
||||
:date (format-time-string "%FT%T") ;; avoid error
|
||||
|
@ -80,22 +87,22 @@ the current query; otherwise, it links to the message at point.")
|
|||
(date (format-time-string "%FT%T" (plist-get msg :date)))
|
||||
(msgid (or (plist-get msg :message-id)
|
||||
(mu4e-error "Cannot link message without message-id")))
|
||||
(props `(:type "mu4e"
|
||||
:date ,date
|
||||
:from ,(mu4e-contact-full from)
|
||||
:fromname ,(mu4e-contact-name from)
|
||||
:fromnameoraddress ,(or (mu4e-contact-name from)
|
||||
(mu4e-contact-email from)) ;; mu4e-specific
|
||||
:maildir ,(plist-get msg :maildir)
|
||||
:message-id ,msgid
|
||||
:path ,(plist-get msg :path)
|
||||
:subject ,(plist-get msg :subject)
|
||||
:to ,(mu4e-contact-full to)
|
||||
:tonameoraddress ,(or (mu4e-contact-name to)
|
||||
(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)))
|
||||
(props `(:type "mu4e"
|
||||
:date ,date
|
||||
:from ,(mu4e-contact-full from)
|
||||
:fromname ,(mu4e-contact-name from)
|
||||
:fromnameoraddress ,(or (mu4e-contact-name from)
|
||||
(mu4e-contact-email from)) ;; mu4e-specific
|
||||
:maildir ,(plist-get msg :maildir)
|
||||
:message-id ,msgid
|
||||
:path ,(plist-get msg :path)
|
||||
:subject ,(plist-get msg :subject)
|
||||
:to ,(mu4e-contact-full to)
|
||||
:tonameoraddress ,(or (mu4e-contact-name to)
|
||||
(mu4e-contact-email to)) ;; mu4e-specific
|
||||
:link ,(concat "mu4e:msgid:" msgid)
|
||||
:description ,(funcall mu4e-org-link-desc-func msg))))
|
||||
(apply #'mu4e--org-link-store-props props)))
|
||||
|
||||
(defun mu4e-org-store-link ()
|
||||
"Store a link to a mu4e message or query.
|
||||
|
|
Loading…
Reference in New Issue