mu4e-mime-parts: cosmetics

This commit is contained in:
Dirk-Jan C. Binnema
2024-11-15 18:50:35 +02:00
parent f68d9a9b40
commit 5e340e3b5d

View File

@ -1,6 +1,6 @@
;;; mu4e-mime-parts.el --- Dealing with MIME-parts & URLs -*- lexical-binding: t -*- ;;; mu4e-mime-parts.el --- Dealing with MIME-parts & URLs -*- lexical-binding: t -*-
;; Copyright (C) 2023 Dirk-Jan C. Binnema ;; Copyright (C) 2023-2024 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@ -24,20 +24,15 @@
;; Implements functions and variables for dealing with MIME-parts and URLs. ;; Implements functions and variables for dealing with MIME-parts and URLs.
;;; TODO: ;;; TODO:
;; [~] mime part candidate sorting -> is his even possible generally? ;; [~] mime part candidate sorting -> is his even possible generally?
;; [ ] URL support ;; [ ] URL support
;;; Code: ;;; Code:
(require 'mu4e-vars) (require 'mu4e-vars)
(require 'mu4e-folders) (require 'mu4e-folders)
(require 'gnus-art) (require 'gnus-art)
(defcustom mu4e-view-open-program (defcustom mu4e-view-open-program
(pcase system-type (pcase system-type
('darwin "open") ('darwin "open")
@ -54,7 +49,6 @@ specified a function as viewer."
:type '(choice string function) :type '(choice string function)
:group 'mu4e-view) :group 'mu4e-view)
;; remember the mime-handles, so we can clean them up when ;; remember the mime-handles, so we can clean them up when
;; we quit this buffer. ;; we quit this buffer.
(defvar-local mu4e~gnus-article-mime-handles nil) (defvar-local mu4e~gnus-article-mime-handles nil)
@ -66,11 +60,9 @@ specified a function as viewer."
(mm-destroy-parts mu4e~gnus-article-mime-handles) (mm-destroy-parts mu4e~gnus-article-mime-handles)
(setq mu4e~gnus-article-mime-handles nil))) (setq mu4e~gnus-article-mime-handles nil)))
;;; MIME-parts ;;; MIME-parts
(defvar-local mu4e--view-mime-parts nil (defvar-local mu4e--view-mime-parts nil
"Cached MIME parts for this message.") "Cached MIME parts for this message.")
(defun mu4e-view-mime-parts() (defun mu4e-view-mime-parts()
"Get the list of MIME parts for this message. "Get the list of MIME parts for this message.
@ -176,8 +168,8 @@ Otherwise, return a file with a unique number appended to the base-name."
:keymap mu4e-view-completion-minor-mode-map) :keymap mu4e-view-completion-minor-mode-map)
(defun mu4e--part-annotation (candidate part type longest-filename) (defun mu4e--part-annotation (candidate part type longest-filename)
"Calculate the annotation candidates as per "Calculate the annotation candidates as per annotation.
`:annotation-function' (see `completion-extra-properties') I.e., `:annotation-function' (see `completion-extra-properties')
CANDIDATE is the value to annotate. CANDIDATE is the value to annotate.
@ -227,7 +219,6 @@ information' is used for alignment."
(format "%s" (concat "-> " target)))) (format "%s" (concat "-> " target))))
(_ (mu4e-error "Unsupported annotation type %s" type))))) (_ (mu4e-error "Unsupported annotation type %s" type)))))
(defvar helm-comp-read-use-marked) (defvar helm-comp-read-use-marked)
(defun mu4e--completing-read-real (prompt candidates multi) (defun mu4e--completing-read-real (prompt candidates multi)
"Call the appropriate completion-read function. "Call the appropriate completion-read function.
@ -381,7 +372,6 @@ Each of the actions is a plist with keys
;; or as a string parameter to a function ;; or as a string parameter to a function
).") ).")
(defun mu4e--view-mime-part-to-temp-file (handle) (defun mu4e--view-mime-part-to-temp-file (handle)
"Write MIME-part HANDLE to a temporary file and return the file name. "Write MIME-part HANDLE to a temporary file and return the file name.
The filename is deduced from the MIME-part's filename, or The filename is deduced from the MIME-part's filename, or
@ -496,6 +486,5 @@ the third MIME-part."
(display-buffer buf))) (display-buffer buf)))
(provide 'mu4e-mime-parts) (provide 'mu4e-mime-parts)
;;; mu4e-mime-parts.el ends here ;;; mu4e-mime-parts.el ends here