From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 323EF431FD0 for ; Tue, 31 May 2011 07:47:41 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m1vZposd4edA for ; Tue, 31 May 2011 07:47:38 -0700 (PDT) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id 8C5C8431FB6 for ; Tue, 31 May 2011 07:47:38 -0700 (PDT) Received: from thor.loria.fr (unknown [IPv6:2001:660:4501:1:dad3:85ff:fe94:599c]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id 3D6196A06A9 for ; Tue, 31 May 2011 16:47:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1306853257; bh=ePJmsmGRoahImOEf5i2IjeX5QCsIMhoDDXWfZ3deFeM=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=nbuXc/3hai5vrKbaVUwI0Acxr7HomSxHRt39Xy8WgVw+0os8uvb5D5X0etD0ahXCR /TsGcKAG//AB8bDUFs+0RiOkDQf1MeES8Nihk0JjLNFVJ7qzgWYx8/fL1PFfWUz2RB 4A6Dp/Iy9Fni6s7otUfcztfPCk6eQIv4ETRYj2HU= From: Thomas Jost To: notmuch Subject: [RFC] Several minor enhancements to the Emacs interface User-Agent: Notmuch/0.5-216-g0154922 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-unknown-linux-gnu) Date: Tue, 31 May 2011 16:47:27 +0200 Message-ID: <87pqmznczk.fsf@thor.loria.fr> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 14:47:41 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi list, The thread regarding multiple sender identities seems to have been of interest for several people, so I'd like to share a few other snippets From=20my Emacs configuration file. Please tell me what you think of them. If you like them, I'd be glad to write some patches so they can be merged in notmuch. *** HTML support *** The current solution for opening HTML parts in a browser seems to be an external script relying on the "munpack" executable: http://notmuchmail.org/emacstips/#index8h2 However Emacs has everything that is needed. Here's a function that will open text/html parts in a browser using nothing but pure elisp: (defun schnouki/notmuch-view-html () "Open the HTML parts of a mail in a web browser." (interactive) (with-current-notmuch-show-message (let ((mm-handle (mm-dissect-buffer))) (notmuch-foreach-mime-part (lambda (p) (if (string-equal (mm-handle-media-type p) "text/html") (mm-display-external p (lambda () (message "Opening web browser...") (browse-url-of-buffer) (bury-buffer))))) mm-handle)))) (Bound to "H" in notmuch-show-mode in my .emacs) *** Filter by date *** When displaying a search with lots of results (like tag:notmuch...), I'm often only interested in what happened during the last few days. Here's a little function, bound to "d" in notmuch-search-mode in my .emacs, that asks for the number of days to display on restricts the search accordingly: (defun schnouki/notmuch-search-filter-by-date (days) (interactive "NNumber of days to display: ") (let* ((now (current-time)) (beg (time-subtract now (days-to-time days))) (filter (concat (format-time-string "%s.." beg) (format-time-string "%s" now)))) (notmuch-search-filter filter))) The funny thing is that it also works with decimal inputs: d 1.5 RET, and here is the list of messages received during the last 36 hours :) This is really basic and could be improved by using something like calendar-read-date (or better: org-read-date) to select the bounds of the search. Please tell me if you're interested. *** Autorefresh notmuch-hello via D-Bus *** I process my incoming mails with a massive shell scripts that does many things: the obvious and essential ones (offlineimap, notmuch new, call autotag script), and the optional and fancy ones (update desktop widget with a unread messages counter, display a desktop notification with the last unread messages, make a daily backup of the notmuch DB, etc.). A recent addition was to tell Emacs to update the *notmuch-hello* buffer by calling a D-Bus method. This requires Emacs 23 compiled with D-Bus support. Here's the corresponding code: (require 'dbus) (defun schnouki/notmuch-dbus-notify () (when (get-buffer "*notmuch-hello*") (message "Notmuch notify") (notmuch-hello-update t))) (dbus-register-method :session dbus-service-emacs dbus-path-emacs dbus-service-emacs "NotmuchNotify" 'schnouki/notmuch-dbus-notify) The shell script then runs the following command: dbus-send --session --dest=3D"org.gnu.Emacs" \ "/org/gnu/Emacs" "org.gnu.Emacs.NotmuchNotify" Et voil=C3=A0! *notmuch-hello* is updated. (This probably shouldn't be integrated in notmuch because it has almost nothing to do with notmuch itself, but it's still a cool hack and I'm quite proud of it, so I just wanted to share it here :)) *** Automagical message signature selection *** This function selects the signature to insert at the end of a message according to the From header. It's based on a set of rules: when the From=20header matches a rule, the content of the corresponding file is inserted at the end of the message. (setq schnouki/message-signatures '(("me@work.tld" . "~/.signature/work= ") ("me@fsfe.org" . "~/.signature/fsfe= ") (".*" . "~/.signature/norm= al")) (defun schnouki/choose-signature () (let* ((from (message-fetch-field "From")) (sigfile (catch 'first-match (dolist (re-file schnouki/message-signatures) (when (string-match-p (car re-file) from) (throw 'first-match (cdr re-file))))))) (if sigfile (with-temp-buffer (insert-file-contents sigfile) (buffer-string))))) (setq message-signature 'schnouki/choose-signature) *** Not done yet :) *** notmuch-search-archive-thread and notmuch-show-archive-thread are nice, but they only remove the "inbox" tag. When quickly browsing through messages I don't wan't to read, I'd also want it to remove the "unread" tag. Right now I copy-pasted them in my .emacs and just added that manually, but I'd like it better if the list of tags removed by *-archive-thread could be customized. So I'll probably write a patch that adds a "notmuch-archive-removed-tags" customization variable and updates the *-archive-thread functions to take that into account. If you're interested, all of these snippets (and some other ones) are available in the mail section of my .emacs: https://github.com/Schnouki/dotfiles/blob/master/emacs/init-50-mail.el Please tell me what you think about all of that, and if there are particular pieces that you would like to see included in notmuch :) Regards, =2D-=20 Thomas/Schnouki --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJN5P+AAAoJEMPdciX+bh5Ist8H/j10rfyAJxnuVkzVIC4viJ6K TJ5i8ARri+tYsFDDrPv6JCKX+NhwO7U8I7wwYsS07moHIrJox8fKYxPLTR8WozzN eIgOhN8/9BiFt/sArcvA2FMJTnc7Y2AjEwrDq3cm5Kb+gzrwaHtien/1dVnw55XM j1/EvBVGhg9CPLoU0Cr7Zsb3T8R+PfJqNVQL7X9V+PivgIb13rNDDnqButMBypU5 Ovb4gNDeReVgC7md8jjBsz0nAth9zJ3aNXb1n3668dkmjx+5+QBFMmYxhh1XqQyP yHThfUalL2rRkeg466+Z8B/VwA+ioZacyd+kmS873jsHz4AMGdrbdPJrIRc2O0w= =Rs/x -----END PGP SIGNATURE----- --=-=-=--