From: Austin Clements Date: Thu, 30 May 2013 01:13:43 +0000 (+2000) Subject: [PATCH v2 0/5] emacs: Part command improvements X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9410148c29492015d16d8dca33d988fe6680ae48;p=notmuch-archives.git [PATCH v2 0/5] emacs: Part command improvements --- diff --git a/e9/2b7159d0edb27daa3a1d012ec832bf3f1183ae b/e9/2b7159d0edb27daa3a1d012ec832bf3f1183ae new file mode 100644 index 000000000..8863fbfc3 --- /dev/null +++ b/e9/2b7159d0edb27daa3a1d012ec832bf3f1183ae @@ -0,0 +1,192 @@ +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 68B3F431FAE + for ; Wed, 29 May 2013 18:14:06 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 WrjHLkiiSPk7 for ; + Wed, 29 May 2013 18:13:58 -0700 (PDT) +Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu + [18.7.68.35]) + by olra.theworths.org (Postfix) with ESMTP id 76B20431FAF + for ; Wed, 29 May 2013 18:13:58 -0700 (PDT) +X-AuditID: 12074423-b7f826d000001438-61-51a6a7d6fe27 +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP + id DD.9D.05176.6D7A6A15; Wed, 29 May 2013 21:13:58 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r4U1Dt6H015111; + Wed, 29 May 2013 21:13:55 -0400 +Received: from drake.dyndns.org (c-76-21-105-205.hsd1.ca.comcast.net + [76.21.105.205]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4U1DqVn003002 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Wed, 29 May 2013 21:13:54 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1UhrR9-0003Yo-Ta; Wed, 29 May 2013 21:13:51 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v2 0/5] emacs: Part command improvements +Date: Wed, 29 May 2013 21:13:43 -0400 +Message-Id: <1369876428-13537-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFlrCIsWRmVeSWpSXmKPExsUixG6nrntt+bJAg7m7+SxWz+WxuH5zJrMD + k8fOWXfZPZ6tusUcwBTFZZOSmpNZllqkb5fAlbH251SWgmfqFQ9Ob2VpYPws38XIySEhYCLx + 4ek1RghbTOLCvfVsXYxcHEIC+xgl7l65xQ7hbGSUmLB+MVTmNJNE84Y2JghnLqPE2hcX2EH6 + 2QQ0JLbtXw42S0RAWmLn3dmsIDazgKzEj/N/wGxhAQuJd0dawepZBFQlHj+aADSVg4NXwEFi + xiEXiDMUJbqfTWCbwMi7gJFhFaNsSm6Vbm5iZk5xarJucXJiXl5qka6ZXm5miV5qSukmRnBg + uCjvYPxzUOkQowAHoxIP7watZYFCrIllxZW5hxglOZiURHnXLAUK8SXlp1RmJBZnxBeV5qQW + H2KU4GBWEuFdow2U401JrKxKLcqHSUlzsCiJ815LuekvJJCeWJKanZpakFoEk5Xh4FCS4C1a + BtQoWJSanlqRlplTgpBm4uAEGc4DNFwJpIa3uCAxtzgzHSJ/ilFRSpzXFiQhAJLIKM2D64VF + 7itGcaBXhCFW8ACjHq77FdBgJqDB4syLQQaXJCKkpBoYvRluf/Y6eWH7ajGh2b31LALeOeZH + Lr1155p+loHvbqLBYp8n59wnBpTWzfncPD+ij9n0kNW3Ss737E/Kr0fyVdnxnBRe9Sd6UrJz + euzea73FXtfeNyW02rjyTM3Of3h25q+Am7t2bprwWtL81WqHa+YTOR96qqYXOJVz6YjolKQ6 + 3jSskf6jxFKckWioxVxUnAgA6SomZ7cCAAA= +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 01:14:06 -0000 + +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." + +