From: Mark Walters Date: Thu, 30 May 2013 14:33:21 +0000 (+0100) Subject: Re: [PATCH v2 0/5] emacs: Part command improvements X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a42019aa0f5b326919a262d124eb44a31ea0f39a;p=notmuch-archives.git Re: [PATCH v2 0/5] emacs: Part command improvements --- diff --git a/7b/203bde82bb154cd04704c0caf6feaa073fb436 b/7b/203bde82bb154cd04704c0caf6feaa073fb436 new file mode 100644 index 000000000..0cd5d3107 --- /dev/null +++ b/7b/203bde82bb154cd04704c0caf6feaa073fb436 @@ -0,0 +1,200 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 125A0431FB6 + for ; Thu, 30 May 2013 07:33:41 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 PcSsA6FYWOFv for ; + Thu, 30 May 2013 07:33:32 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 938CE431FAE + for ; Thu, 30 May 2013 07:33:32 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1Ui3ut-0002P3-1l; Thu, 30 May 2013 15:33:28 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1Ui3us-0000lS-7O; Thu, 30 May 2013 15:33:22 +0100 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v2 0/5] emacs: Part command improvements +In-Reply-To: <1369876428-13537-1-git-send-email-amdragon@mit.edu> +References: <1369876428-13537-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1 + (i486-pc-linux-gnu) +Date: Thu, 30 May 2013 15:33:21 +0100 +Message-ID: <87k3mgh70u.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 754b925b7f2ccd33a9a4934d587db674 (of first 20000 bytes) +X-SpamAssassin-Score: -0.1 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -0.1 points. + Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.1 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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: Thu, 30 May 2013 14:33:41 -0000 + + +This looks excellent. +1 from me. + +Best wishes + +Mark + + +Austin Clements writes: + +> This is v2 of id:87zjvghx82.fsf@qmul.ac.uk. In addition to some +> general improvements, this fixes the handling of part overlays in +> indented messages, removes the special part button map entirely in +> favor of the "." submap, and adds a NEWS patch. +> +> The diff from v1 follows +> +> diff --git a/NEWS b/NEWS +> index a7f2ec6..23f4c6a 100644 +> --- a/NEWS +> +++ b/NEWS +> @@ -61,6 +61,22 @@ notmuch-vim, but of course that is their decision. +> Emacs Interface +> --------------- +> +> +New keymap to view/save parts +> + +> + To view or save a single MIME part of a message, use the new "." +> + submap (e.g., ". s" to save, ". v" to view). Previously, these keys +> + were only available when point was on a part button and they did not +> + have the "." prefix, so they were difficult to invoke (impossible if +> + a part did not have a button) and clashed with other bindings. +> + These new bindings also appear in show's help, so you don't have to +> + memorize them. +> + +> +Default part save directory is now `mm-default-directory` +> + +> + Previously, notmuch offered to save parts and attachments to a mix +> + of `mm-default-directory`, `mailcap-download-directory`, and `~/`. +> + This has been standardized on `mm-default-directory`. +> + +> No Emacs 22 support +> +> The Emacs 22 support added late 2010 was sufficient only for a short +> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +> index 09ce25e..2186783 100644 +> --- a/emacs/notmuch-lib.el +> +++ b/emacs/notmuch-lib.el +> @@ -360,21 +360,17 @@ OBJECT." +> below +> string)) +> +> -(defun notmuch-put-text-property-if-nil (start end property value +> - &optional object) +> - "Like `put-text-property', but only set the property where it is nil." +> +(defun notmuch-map-text-property (start end prop func &optional object) +> + "Transform text property PROP using FUNC. +> + +> +Applies FUNC to each distinct value of the text property PROP +> +between START and END of OBJECT, setting PROP to the value +> +returned by FUNC." +> (while (< start end) +> - (let ((start-nil (text-property-any start end property nil object))) +> - (if (null start-nil) +> - ;; There are no more nil regions; exit the loop +> - (setq start end) +> - ;; Find the end of the nil region +> - (let ((end-nil +> - (or (text-property-not-all start-nil end property nil object) +> - end))) +> - ;; Set the property +> - (put-text-property start-nil end-nil property value object) +> - (setq start end-nil)))))) +> + (let ((value (get-text-property start prop object)) +> + (next (next-single-property-change start prop object end))) +> + (put-text-property start next prop (funcall func value) object) +> + (setq start next)))) +> +> (defun notmuch-logged-error (msg &optional extra) +> "Log MSG and EXTRA to *Notmuch errors* and signal MSG. +> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +> index 380b144..613e666 100644 +> --- a/emacs/notmuch-show.el +> +++ b/emacs/notmuch-show.el +> @@ -466,7 +466,6 @@ message at DEPTH in the current thread." +> +> (define-button-type 'notmuch-show-part-button-type +> 'action 'notmuch-show-part-button-default +> - 'keymap 'notmuch-show-part-button-map +> 'follow-link t +> 'face 'message-mml +> :supertype 'notmuch-button-type) +> @@ -843,8 +842,15 @@ If HIDE is non-nil then initially hide this part." +> (insert "\n")) +> (notmuch-show-create-part-overlays msg beg (point) hide) +> ;; Record part information. Since we already inserted subparts, +> - ;; don't override exiting :notmuch-part properties. +> - (notmuch-put-text-property-if-nil beg (point) :notmuch-part part))) +> + ;; don't override existing :notmuch-part properties. +> + (notmuch-map-text-property beg (point) :notmuch-part +> + (lambda (v) (or v part))) +> + ;; Make :notmuch-part front sticky and rear non-sticky so it stays +> + ;; applied to the beginning of each line when we indent the message. +> + (notmuch-map-text-property beg (point) 'front-sticky +> + (lambda (v) (pushnew :notmuch-part v))) +> + (notmuch-map-text-property beg (point) 'rear-nonsticky +> + (lambda (v) (pushnew :notmuch-part v))))) +> +> (defun notmuch-show-insert-body (msg body depth) +> "Insert the body BODY at depth DEPTH in the current thread." +> @@ -1194,11 +1200,6 @@ reset based on the original query." +> "Submap for part commands") +> (fset 'notmuch-show-part-map notmuch-show-part-map) +> +> -(defvar notmuch-show-part-button-map +> - (make-composed-keymap notmuch-show-part-map button-map) +> - "Keymap for part button commands") +> -(fset 'notmuch-show-part-button-map notmuch-show-part-button-map) +> - +> (defvar notmuch-show-mode-map +> (let ((map (make-sparse-keymap))) +> (define-key map "?" 'notmuch-help) +> @@ -1365,7 +1366,7 @@ Some useful entries are: +> (get-text-property (point) :notmuch-message-properties))) +> +> (defun notmuch-show-get-part-properties () +> - "Return the properties of the part containing point. +> + "Return the properties of the innermost part containing point. +> +> This is the part property list retrieved from the CLI. Signals +> an error if there is no part containing point."