mu4e: add mu4e-view-toggle-html

Add `mu4e-view-toggle-html' for toggling between html and text display
of messages (when available); keybinding 'h'. Document this.

The new default keybinging for mu4e-view-toggle-hide-cited becomes '#'.
This commit is contained in:
djcb 2015-12-27 10:28:11 +02:00
parent 48388c9d1b
commit 29a44e4371
3 changed files with 26 additions and 9 deletions

View File

@ -42,6 +42,11 @@
behavior. behavior.
- overwrite target message files that already exist, rather than - overwrite target message files that already exist, rather than
erroring out. erroring out.
- set mu4e-view-html-plaintext-ratio-heuristic to 5, as 10 was too
high to detect some effectively html-only messages
- add mu4e-view-toggle-html (keybinding: 'h') to toggle between
text and html display. The existing 'mu4e-view-toggle-hide-cited'
gets the new binding '#'.
** 0.9.13 ** 0.9.13

View File

@ -640,7 +640,8 @@ FUNC should be a function taking two arguments:
;; misc ;; misc
(define-key map "w" 'visual-line-mode) (define-key map "w" 'visual-line-mode)
(define-key map "h" 'mu4e-view-toggle-hide-cited) (define-key map "#" 'mu4e-view-toggle-hide-cited)
(define-key map "h" 'mu4e-view-toggle-html)
(define-key map (kbd "M-q") 'mu4e-view-fill-long-lines) (define-key map (kbd "M-q") 'mu4e-view-fill-long-lines)
;; next 3 only warn user when attempt in the message view ;; next 3 only warn user when attempt in the message view
@ -663,6 +664,8 @@ FUNC should be a function taking two arguments:
(define-key menumap [sepa0] '("--")) (define-key menumap [sepa0] '("--"))
(define-key menumap [wrap-lines] (define-key menumap [wrap-lines]
'("Toggle wrap lines" . visual-line-mode)) '("Toggle wrap lines" . visual-line-mode))
(define-key menumap [hide-cited]
'("Toggle view-html" . mu4e-view-toggle-html))
(define-key menumap [hide-cited] (define-key menumap [hide-cited]
'("Toggle hide cited" . mu4e-view-toggle-hide-cited)) '("Toggle hide cited" . mu4e-view-toggle-hide-cited))
(define-key menumap [raw-view] (define-key menumap [raw-view]
@ -704,8 +707,6 @@ FUNC should be a function taking two arguments:
'("Search bookmark" . mu4e-headers-search-bookmark)) '("Search bookmark" . mu4e-headers-search-bookmark))
(define-key menumap [jump] (define-key menumap [jump]
'("Jump to maildir" . mu4e~headers-jump-to-maildir)) '("Jump to maildir" . mu4e~headers-jump-to-maildir))
(define-key menumap [refresh]
'("Refresh" . mu4e-headers-rerun-search))
(define-key menumap [search] (define-key menumap [search]
'("Search" . mu4e-headers-search)) '("Search" . mu4e-headers-search))
@ -917,6 +918,12 @@ the new docid. Otherwise, return nil."
(mu4e-view-refresh) (mu4e-view-refresh)
(mu4e~view-hide-cited))) (mu4e~view-hide-cited)))
(defun mu4e-view-toggle-html ()
"Toggle html-display of the message body (if any)."
(interactive)
(setq mu4e-view-prefer-html (not mu4e-view-prefer-html))
(mu4e-view-refresh))
(defun mu4e-view-refresh () (defun mu4e-view-refresh ()
"Redisplay the current message." "Redisplay the current message."
(interactive) (interactive)

View File

@ -1191,8 +1191,10 @@ misc
---- ----
; switch focus ; switch focus
c copy address at point (with C-u copy long version) c copy address at point (with C-u copy long version)
h toggle between html/text (if available)
w toggle line wrapping w toggle line wrapping
h toggle showing cited parts # toggle showing cited parts
v show details about the cryptographic signature v show details about the cryptographic signature
@ -1267,13 +1269,16 @@ is used for images.
@node Displaying rich-text messages @node Displaying rich-text messages
@section Displaying rich-text messages @section Displaying rich-text messages
@t{mu4e} normally prefers the plain-text version for messages that consist of @t{mu4e} normally prefers the plain-text version for messages that
both a plain-text and html (rich-text) versions of the body-text. You can consist of both a plain-text and html (rich-text) versions of the
change this by setting @code{mu4e-view-prefer-html} to @t{t}. body-text. You can change this by setting @code{mu4e-view-prefer-html}
to @t{t}. And you can toggle this value (globally) using @kbd{h} in the
message view; this also refreshes the message with the new setting.
If there is only an html-version, or if the plain-text version is too If there is only an html-version, or if the plain-text version is too
short in comparison with the html part@footnote{this is for the case short in comparison with the html part@footnote{this is e.g. for the
where the text-part only warns that you should use the html-version}, case where the text-part is only a short blurb telling you to use the
html-version; see @code{mu4e-view-html-plaintext-ratio-heuristic}},
@t{mu4e} tries to convert the html into plain-text for display. @t{mu4e} tries to convert the html into plain-text for display.
The default way to do that is to use the @command{emacs} built-in The default way to do that is to use the @command{emacs} built-in