From 3e6ff7fb522c3a6f32047ed3d1e100f2e24978a0 Mon Sep 17 00:00:00 2001 From: djcb Date: Tue, 14 Feb 2012 20:25:13 +0200 Subject: [PATCH] * mu4e: make help context-sensitive --- emacs/mu4e-hdrs.el | 1 - emacs/mu4e-main.el | 14 -------------- emacs/mu4e.el | 23 ++++++++++++++++++++++- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/emacs/mu4e-hdrs.el b/emacs/mu4e-hdrs.el index 18f60892..e24365d8 100644 --- a/emacs/mu4e-hdrs.el +++ b/emacs/mu4e-hdrs.el @@ -286,7 +286,6 @@ after the end of the search results." (define-key map "H" 'mu4e-display-manual) - ;; menu (define-key map [menu-bar] (make-sparse-keymap)) (let ((menumap (make-sparse-keymap "Headers"))) diff --git a/emacs/mu4e-main.el b/emacs/mu4e-main.el index 1481782d..8e749b70 100644 --- a/emacs/mu4e-main.el +++ b/emacs/mu4e-main.el @@ -167,18 +167,4 @@ clicked." "Outgoing mail will now be sent directly")) (mu4e-main-view)) -(defun mu4e-display-manual () - "Display the mu4e manual info pages." - (interactive) - (info-display-manual "mu4e")) - - -(defun mu4e-quit() - "Quit the mm session." - (interactive) - (when (y-or-n-p "Are you sure you want to quit? ") - (message nil) - (mu4e-kill-proc) - (kill-buffer))) - (provide 'mu4e-main) diff --git a/emacs/mu4e.el b/emacs/mu4e.el index 0cdb39ac..a691bcdc 100644 --- a/emacs/mu4e.el +++ b/emacs/mu4e.el @@ -579,7 +579,8 @@ uses the emacs built-in `html2text'. Alternatively, if ;; there's no text part, or it's very small (with-temp-buffer (insert html) - (if mu4e-html2text-command ;; if defined, use the external tool + ;; if defined, use the external tool + (if mu4e-html2text-command (shell-command-on-region (point-min) (point-max) mu4e-html2text-command nil t) @@ -591,6 +592,26 @@ uses the emacs built-in `html2text'. Alternatively, if ;; and finally, remove some crap from the remaining string. (replace-regexp-in-string "[  ]" " " body nil nil nil))) + +(defun mu4e-display-manual () + "Display the mu4e manual page for the current mode, or go to the +top level if there is none." + (interactive) + (info (case major-mode + ('mu4e-main-mode "(mu4e)Main view") + ('mu4e-hdrs-mode "(mu4e)Headers view") + ('mu4e-view-mode "(mu4e)Message view") + (t "mu4e")))) + +(defun mu4e-quit() + "Quit the mm session." + (interactive) + (when (y-or-n-p "Are you sure you want to quit? ") + (message nil) + (mu4e-kill-proc) + (kill-buffer))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'mu4e)