mu4e-view: Add defcustom mu4e-view-open-program

When xdg-open is not enough.
This commit is contained in:
Dirk-Jan C. Binnema 2022-01-12 22:32:21 +02:00
parent 324b6f5022
commit b072b4a57e
2 changed files with 24 additions and 15 deletions

View File

@ -44,9 +44,9 @@
- the old mu4e-view is *gone*; only the gnus-based one remains. This allowed
for removing quite a bit of old code.
- the mu4e message rendering is much faster (a factor of 3+), which
makes displaying big results snappier. This required some updates in the
headers handling and in the server protocol.
- the mu4e headers rendering is much faster (a factor of 3+), which makes
displaying big results snappier. This required some updates in the headers
handling and in the server protocol.
- ~mu4e-index-updated-hook~ now fires after indexing completed, regardless of
whether anything changed (before, it fired only is something changed). In
@ -63,6 +63,10 @@
automatically change the ~Organization:~ header, and attempts to update the
message signature. Also, there's a key-binding now: ~C-c ;~
- A new ~defcustom~, ~mu4e-view-open-program~ for starting the appropriate
program for a give file (e.g., ~xdg-open~). There are some reasonable
defaults for various systems.
- undo is now supported across message-saves
- a lot of the internals have been changed:

View File

@ -91,11 +91,22 @@ The first letter of NAME is used as a shortcut character."
:group 'mu4e-view
:type '(alist :key-type string :value-type function))
(defcustom mu4e-view-open-program
(pcase system-type
('darwin "open")
('cygwin "cygstart")
(_ "xdg-open"))
"Tool to open the correct program for a given file."
:type 'string
:group 'mu4e-view)
(defcustom mu4e-view-max-specpdl-size 4096
"The value of `max-specpdl-size' for displaying messages with Gnus."
:type 'integer
:group 'mu4e-view)
;;; Old options
@ -671,10 +682,7 @@ determine which browser function to use."
(mm-destroy-parts parts))))
(defun mu4e-action-view-in-xwidget (msg)
"Show current MSG in an embedded xwidget, if available.
This is an experimental feature; this appear to work for all
messages."
"Show current MSG in an embedded xwidget, if available."
(unless (fboundp 'xwidget-webkit-browse-url)
(mu4e-error "No xwidget support available"))
(let ((browse-url-browser-function
@ -1196,14 +1204,11 @@ The directory and file are self-destructed."
"Open FILE with default handler, if any.
Otherwise, or if FORCE-ASK is set, ask user for the program to
open with."
(let* ((opener
(pcase system-type
(`darwin "open")
((or 'gnu 'gnu/linux 'gnu/kfreebsd) "xdg-open")))
(prog (if (or force-ask (not opener))
(read-shell-command "Open MIME-part with: ")
opener)))
(call-process prog nil 0 nil file)))
(let ((opener
(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)
"Apply some action to MIME-part N in the current messsage.