From 29a44e43714e43916c9d7134e84e9bdab937be90 Mon Sep 17 00:00:00 2001 From: djcb Date: Sun, 27 Dec 2015 10:28:11 +0200 Subject: [PATCH] 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 '#'. --- NEWS.org | 5 +++++ mu4e/mu4e-view.el | 13 ++++++++++--- mu4e/mu4e.texi | 17 +++++++++++------ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/NEWS.org b/NEWS.org index 313c4ad7..cc850b8c 100644 --- a/NEWS.org +++ b/NEWS.org @@ -42,6 +42,11 @@ behavior. - overwrite target message files that already exist, rather than 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 diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index f4ce4849..773ca699 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -640,7 +640,8 @@ FUNC should be a function taking two arguments: ;; misc (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) ;; 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 [wrap-lines] '("Toggle wrap lines" . visual-line-mode)) + (define-key menumap [hide-cited] + '("Toggle view-html" . mu4e-view-toggle-html)) (define-key menumap [hide-cited] '("Toggle hide cited" . mu4e-view-toggle-hide-cited)) (define-key menumap [raw-view] @@ -704,8 +707,6 @@ FUNC should be a function taking two arguments: '("Search bookmark" . mu4e-headers-search-bookmark)) (define-key menumap [jump] '("Jump to maildir" . mu4e~headers-jump-to-maildir)) - (define-key menumap [refresh] - '("Refresh" . mu4e-headers-rerun-search)) (define-key menumap [search] '("Search" . mu4e-headers-search)) @@ -917,6 +918,12 @@ the new docid. Otherwise, return nil." (mu4e-view-refresh) (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 () "Redisplay the current message." (interactive) diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index 0b0a1151..5bbb7f3e 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -1191,8 +1191,10 @@ misc ---- ; switch focus c copy address at point (with C-u copy long version) + +h toggle between html/text (if available) w toggle line wrapping -h toggle showing cited parts +# toggle showing cited parts v show details about the cryptographic signature @@ -1267,13 +1269,16 @@ is used for images. @node Displaying rich-text messages @section Displaying rich-text messages -@t{mu4e} normally prefers the plain-text version for messages that consist of -both a plain-text and html (rich-text) versions of the body-text. You can -change this by setting @code{mu4e-view-prefer-html} to @t{t}. +@t{mu4e} normally prefers the plain-text version for messages that +consist of both a plain-text and html (rich-text) versions of the +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 -short in comparison with the html part@footnote{this is for the case -where the text-part only warns that you should use the html-version}, +short in comparison with the html part@footnote{this is e.g. for the +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. The default way to do that is to use the @command{emacs} built-in