mirror of https://github.com/djcb/mu.git
Merge pull request #2242 from tsdh/fn-valued-mu4e-view-open-program
Allow a function as mu4e-view-open-program
This commit is contained in:
commit
b686c9da25
|
@ -96,8 +96,15 @@ The first letter of NAME is used as a shortcut character."
|
||||||
('darwin "open")
|
('darwin "open")
|
||||||
('cygwin "cygstart")
|
('cygwin "cygstart")
|
||||||
(_ "xdg-open"))
|
(_ "xdg-open"))
|
||||||
"Tool to open the correct program for a given file."
|
"Tool to open the correct program for a given file.
|
||||||
:type 'string
|
May also be a function of a single argument, the file to be
|
||||||
|
opened.
|
||||||
|
|
||||||
|
In the function-valued case a likely candidate is
|
||||||
|
`mailcap-view-file' although note that there was an Emacs bug up
|
||||||
|
to Emacs 29 which prevented opening a file if `mailcap-mime-data'
|
||||||
|
specified a function as viewer."
|
||||||
|
:type '(choice string function)
|
||||||
:group 'mu4e-view)
|
:group 'mu4e-view)
|
||||||
|
|
||||||
(defcustom mu4e-view-max-specpdl-size 4096
|
(defcustom mu4e-view-max-specpdl-size 4096
|
||||||
|
@ -144,7 +151,7 @@ The first letter of NAME is used as a shortcut character."
|
||||||
(make-obsolete-variable 'mu4e-cited-regexp "No longer used" "1.7.0")
|
(make-obsolete-variable 'mu4e-cited-regexp "No longer used" "1.7.0")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; Helpers
|
;; Helpers
|
||||||
|
|
||||||
(defun mu4e~view-quit-buffer ()
|
(defun mu4e~view-quit-buffer ()
|
||||||
|
@ -1216,11 +1223,14 @@ The directory and file are self-destructed."
|
||||||
"Open FILE with default handler, if any.
|
"Open FILE with default handler, if any.
|
||||||
Otherwise, or if FORCE-ASK is set, ask user for the program to
|
Otherwise, or if FORCE-ASK is set, ask user for the program to
|
||||||
open with."
|
open with."
|
||||||
(let ((opener
|
(if (and (not force-ask)
|
||||||
(or (and (not force-ask) mu4e-view-open-program
|
(functionp mu4e-view-open-program))
|
||||||
(executable-find mu4e-view-open-program))
|
(funcall mu4e-view-open-program file)
|
||||||
(read-shell-command "Open MIME-part with: "))))
|
(let ((opener
|
||||||
(call-process opener nil 0 nil file)))
|
(or (and (not force-ask) mu4e-view-open-program
|
||||||
|
(executable-find mu4e-view-open-program))
|
||||||
|
(read-shell-command "Open MIME-part with: "))))
|
||||||
|
(call-process opener nil 0 nil file))))
|
||||||
|
|
||||||
(defun mu4e-view-mime-part-action (&optional n)
|
(defun mu4e-view-mime-part-action (&optional n)
|
||||||
"Apply some action to MIME-part N in the current messsage.
|
"Apply some action to MIME-part N in the current messsage.
|
||||||
|
|
Loading…
Reference in New Issue