From 243b862776c1f07431e8e449c5a98003ce4cc94c Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Sat, 3 Sep 2022 16:55:55 -0500 Subject: [PATCH] mu4e-view: use `save-excursion' around toggling html Previously, the cursor would be moved to the first html attachment which would break using mu4e keybindings (e.g. delete). With this change, the cursor isn't moved at all, presumably the expected behavior. --- mu4e/mu4e-view.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 3f047d49..69ed7d96 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -1300,12 +1300,13 @@ the third MIME-part." (interactive) ;; This function assumes `gnus-article-mime-handle-alist' is sorted by ;; pertinence, i.e. the first HTML part found in it is the most important one. - (if-let ((html-part - (seq-find (lambda (handle) - (equal (mm-handle-media-type (cdr handle)) "text/html")) - gnus-article-mime-handle-alist))) - (gnus-article-inline-part (car html-part)) - (mu4e-warn "No html part in this message"))) + (save-excursion + (if-let ((html-part + (seq-find (lambda (handle) + (equal (mm-handle-media-type (cdr handle)) "text/html")) + gnus-article-mime-handle-alist))) + (gnus-article-inline-part (car html-part)) + (mu4e-warn "No html part in this message")))) (defun mu4e-process-file-through-pipe (path pipecmd) "Process file at PATH through a pipe with PIPECMD."