From b92e2d20fd4d8a774116db52ab4b60b78676f187 Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 14 Oct 2013 22:30:29 +0300 Subject: [PATCH 1/6] * mu4e: fix some minor things in the main page --- mu4e/mu4e-main.el | 2 +- mu4e/mu4e-utils.el | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index 14122d41..41c45319 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -134,7 +134,7 @@ clicked." (propertize " Misc\n\n" 'face 'mu4e-title-face) (mu4e~main-action-str "\t* [U]pdate email & database\n" - 'mu4e-update-mail-show-window) + 'mu4e-update-mail-and-index) ;; show the queue functions if `smtpmail-queue-dir' is defined (if (file-directory-p smtpmail-queue-dir) diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index 191e10bf..d8dc162a 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -1016,18 +1016,24 @@ displaying it). Do _not_ bury the current buffer, though." (define-derived-mode mu4e-about-mode org-mode "mu4e:about" "Major mode for the mu4e About page, derived from `org-mode'.") -(define-key mu4e-about-mode-map (kbd "q") 'bury-buffer) (defun mu4e-about () "Show a buffer with the mu4e-about text." (interactive) - (with-current-buffer - (get-buffer-create mu4e~main-about-buffer-name) - (let ((inhibit-read-only t)) - (erase-buffer) - (insert mu4e-about) - (mu4e-about-mode) - (show-all))) + (lexical-let ((oldbuf (current-buffer))) + (with-current-buffer + (get-buffer-create mu4e~main-about-buffer-name) + (define-key mu4e-about-mode-map (kbd "q") + (lambda () ;; XXX it seems unnecessarily hard to do this... + (interactive) + (bury-buffer) + (when (buffer-live-p oldbuf) + (switch-to-buffer oldbuf)))) + (let ((inhibit-read-only t)) + (erase-buffer) + (insert mu4e-about) + (mu4e-about-mode) + (show-all)))) (switch-to-buffer mu4e~main-about-buffer-name) (setq buffer-read-only t) (goto-char (point-min))) From cf4c658223393752cb6bf1a0b7f870db563058e9 Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 14 Oct 2013 22:42:58 +0300 Subject: [PATCH 2/6] * mu4e: don't list footers as attachments --- mu4e/mu4e-view.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 5b5c2697..76ecc670 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -427,12 +427,17 @@ at POINT, or if nil, at (point)." (lambda (part) (let* ((mtype (mu4e-message-part-field part :mime-type)) (attachtype (mu4e-message-part-field part :type)) - (isattach (or ;; we lost parts marked either - ;; "attachment" or "inline" as attachment. - (member 'attachment attachtype) - (member 'inline attachtype)))) + (isattach + (or ;; we consider parts marked either + ;; "attachment" or "inline" as attachment. + (member 'attachment attachtype) + ;; list inline parts as attachment (so they can be + ;; saved), unless they are text/plain, which are + ;; usually just message footers in mailing lists + (and (member 'inline attachtype) + (not (string-match "^text/plain" mtype)))))) (or ;; remove if it's not an attach *or* if it's an - ;; image/audio/application type (but not a signature) + ;; image/audio/application type (but not a signature) isattach (string-match "^\\(image\\|audio\\)" mtype) (string= "message/rfc822" mtype) From 020a13dbd43676b694865348b18d0e63d38c0bee Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 14 Oct 2013 22:43:56 +0300 Subject: [PATCH 3/6] * cosmetics --- mu4e/mu4e-message.el | 19 +++++++++++-------- mu4e/mu4e.texi | 3 +-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/mu4e/mu4e-message.el b/mu4e/mu4e-message.el index 429f537a..24a229fe 100644 --- a/mu4e/mu4e-message.el +++ b/mu4e/mu4e-message.el @@ -37,9 +37,12 @@ (defcustom mu4e-html2text-command nil "Shell command that converts from html to plain text. The command has to read html from stdin and output plain text on -stdout. If this is not defined, the emacs `html2text' tool will -be used when faced with html-only message. If you use htmltext, -it's recommended you use \"html2text -utf8 -width 72\"." +stdout. If this is not defined, the emacs `html2text' tool will be +used when faced with html-only messages. If you use htmltext, it's +recommended you use \"html2text -utf8 -width 72\". + +Alternatives are the python-based html2markdown, w3m and on MacOS +you may want to use textutil." :type 'string :group 'mu4e-view :safe 'stringp) @@ -53,8 +56,8 @@ is always used." (defcustom mu4e-view-html-plaintext-ratio-heuristic 10 "Ratio between the length of the html and the plain text part -under which mu4e will consider the plain text part to be -'This messages requires html' text bodies." +below which mu4e will consider the plain text part to be 'This +messages requires html' text bodies." :type 'integer :group 'mu4e-view) @@ -120,7 +123,7 @@ Thus, function will return nil for empty lists, non-existing body-txt or body-ht val) ((member field '(:docid :size)) 0) ;; numeric type: nil -> 0 - (t + (t val)))) ;; otherwise, just return nil (defsubst mu4e-message-has-field (msg field) @@ -132,7 +135,7 @@ Thus, function will return nil for empty lists, non-existing body-txt or body-ht the headers buffer or the view buffer, or nil if there is no such message. If optional NOERROR is non-nil, do not raise an error when there is no message at point." - (let ((msg (or (get-text-property (point) 'msg) mu4e~view-msg))) + (let ((msg (or (get-text-property (point) 'msg) mu4e~view-msg))) (if msg msg (unless noerror (mu4e-warn "No message at point"))))) @@ -213,7 +216,7 @@ match." (or (and name (string-match rx name)) (and email (string-match rx email))))) - (mu4e-message-field msg cfield)))) + (mu4e-message-field msg cfield)))) (defun mu4e-message-contact-field-matches-me (msg cfield) "Checks whether any of the of the contacts in field diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index b066a481..229308ab 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -1197,7 +1197,7 @@ comparison with the html part@footnote{this is for the case where the text-part only warns that you should use the html-version}, @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 @code{html2text} function. However, you can -set the variable @code{mu4e-html2text-command} to use some external program +set the variable @code{mu4e-html2text-command} to some external program instead. This program is expected to take html from standard input and write plain text in @t{UTF-8} encoding on standard output. @@ -1224,7 +1224,6 @@ On MacOS, there is a program called @t{textutil} as yet another alternative: "textutil -stdin -format html -convert txt -stdout") @end lisp - @node MSGV Crypto @section Crypto From dd83c235cb104a2c286dd251347a35d2632efd02 Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 14 Oct 2013 22:44:11 +0300 Subject: [PATCH 4/6] guile: minor updates --- guile/mu-guile.texi | 3 +-- guile/mu/plot.scm | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/guile/mu-guile.texi b/guile/mu-guile.texi index 83ff0b59..7aff20f5 100644 --- a/guile/mu-guile.texi +++ b/guile/mu-guile.texi @@ -876,8 +876,7 @@ exec guile -s $0 $@ (tm:hour (localtime (mu:date msg))))) (lambda (x y) (< (car x) (car y))))) -(mu:plot-histogram (mail-per-hour-table) "Mail per hour" "Hour" "Frequency" -#t) +(mu:plot-histogram (mail-per-hour-table) "Mail per hour" "Hour" "Frequency") @end lisp @cartouche diff --git a/guile/mu/plot.scm b/guile/mu/plot.scm index ce5ea691..04181352 100644 --- a/guile/mu/plot.scm +++ b/guile/mu/plot.scm @@ -46,16 +46,20 @@ not found." progpath #f)))) -(define* (mu:plot-histogram data title x-label y-label output - #:optional (extra-gnuplot-opts '())) +(define* (mu:plot-histogram data title x-label y-label + #:optional (output "dumb") (extra-gnuplot-opts '())) "Plot DATA with TITLE, X-LABEL and X-LABEL using the gnuplot -program. DATA is a list of cons-pairs (X . Y). OUTPUT is a string +program. DATA is a list of cons-pairs (X . Y). + + OUTPUT is a string that determines the type of output that gnuplot produces, depending on the system. Which options are available depends on the particulars for the gnuplot installation, but typical examples would be \"dumb\" for text-only display, \"wxterm\" to write to a graphical window, or -\"png\" to write a PNG-image to stdout. EXTRA-GNUPLOT-OPTS are any -additional options for gnuplot." +\"png\" to write a PNG-image to stdout. + +EXTRA-GNUPLOT-OPTS is a list +of any additional options for gnuplot." (if (not (find-program-in-path "gnuplot")) (error "cannot find 'gnuplot' in path")) (let ((datafile (export-pairs data)) From feec45a670687111634b47e3938fe9468ff60818 Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 14 Oct 2013 22:44:28 +0300 Subject: [PATCH 5/6] * minor --- mu4e/mu4e-headers.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 829ea66e..43da3ba0 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -731,7 +731,7 @@ after the end of the search results." (defvar mu4e-headers-mode-abbrev-table nil) -(defun mu4e~headers-auto-update () +(defun mu4e~headers-do-auto-update () "Update the current headers buffer after indexing has brought some changes, `mu4e-headers-auto-update' is non-nil and there is no user-interaction ongoing." @@ -753,7 +753,7 @@ user-interaction ongoing." (set (make-local-variable 'hl-line-face) 'mu4e-header-highlight-face) ;; maybe update the current headers upon indexing changes - (add-hook 'mu4e-index-updated-hook 'mu4~headers-auto-update nil t) + (add-hook 'mu4e-index-updated-hook 'mu4~headers-do-auto-update nil t) (setq truncate-lines t buffer-undo-list t ;; don't record undo information From e1a6461522cdb79f21e9ad87aeeb0a717789215f Mon Sep 17 00:00:00 2001 From: djcb Date: Mon, 14 Oct 2013 22:51:24 +0300 Subject: [PATCH 6/6] * mu4e: fix typo --- mu4e/mu4e-headers.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 43da3ba0..683a4a14 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -753,7 +753,7 @@ user-interaction ongoing." (set (make-local-variable 'hl-line-face) 'mu4e-header-highlight-face) ;; maybe update the current headers upon indexing changes - (add-hook 'mu4e-index-updated-hook 'mu4~headers-do-auto-update nil t) + (add-hook 'mu4e-index-updated-hook 'mu4e~headers-do-auto-update nil t) (setq truncate-lines t buffer-undo-list t ;; don't record undo information