Re: [PATCH] cli: add a tool for starting new message in the emacs ui
[notmuch-archives.git] / 58 / e2061b7a8815a1b9e4d8098df86b0d07f38085
1 Return-Path: <amdragon@mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 56EEA431FAF\r
6         for <notmuch@notmuchmail.org>; Sat, 25 May 2013 23:35:09 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id wh1DS0vvz3v2 for <notmuch@notmuchmail.org>;\r
16         Sat, 25 May 2013 23:35:00 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id 531C9431FAE\r
20         for <notmuch@notmuchmail.org>; Sat, 25 May 2013 23:35:00 -0700 (PDT)\r
21 X-AuditID: 1209190d-b7f966d000000944-cb-51a1ad11cb17\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id F3.DF.02372.11DA1A15; Sun, 26 May 2013 02:34:57 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])\r
26         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r4Q6YpmS018417; \r
27         Sun, 26 May 2013 02:34:52 -0400\r
28 Received: from drake.dyndns.org (c-76-21-105-205.hsd1.ca.comcast.net\r
29         [76.21.105.205]) (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4Q6YmGM031619\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sun, 26 May 2013 02:34:50 -0400\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1UgUXZ-000736-Df; Sun, 26 May 2013 02:34:49 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v2] emacs: Don't override mm-show-part in\r
40         notmuch-show-view-part\r
41 Date: Sun, 26 May 2013 02:34:46 -0400\r
42 Message-Id: <1369550086-26986-1-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 In-Reply-To: <8761ycc19t.fsf@qmul.ac.uk>\r
45 References: <8761ycc19t.fsf@qmul.ac.uk>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsUixCmqrSu4dmGgQe93Y4sbrd2MFqvn8lhc\r
48         vzmT2YHZY+esu+wez1bdYvbYcug9cwBzFJdNSmpOZllqkb5dAlfGl8ebWQsuC1fcm/mRqYHx\r
49         H38XIyeHhICJRMvEp2wQtpjEhXvrwWwhgX2MEtv/l3YxcgHZGxklnj5Zww7hnGaS+Pt5HQtE\r
50         1VxGiQf9UiA2m4CGxLb9yxlBbBEBaYmdd2ezgtjMArESjW+XMXcxcnAICwRILPqtC2KyCKhK\r
51         bFsTDVLBK+Ag0dFyixHiBkWJ7mcTwG7gBJrY3fyGHWKTusTrh9/YJjDyL2BkWMUom5JbpZub\r
52         mJlTnJqsW5ycmJeXWqRrpJebWaKXmlK6iREcVpK8OxjfHVQ6xCjAwajEwyvhsDBQiDWxrLgy\r
53         9xCjJAeTkiiv5wqgEF9SfkplRmJxRnxRaU5q8SFGCQ5mJRHeg2pAOd6UxMqq1KJ8mJQ0B4uS\r
54         OO+VlJv+QgLpiSWp2ampBalFMFkZDg4lCd4bq4EaBYtS01Mr0jJzShDSTBycIMN5gIa/Banh\r
55         LS5IzC3OTIfIn2JUlBLn/QSSEABJZJTmwfXC4v4VozjQK8K8f0GqeIApA677FdBgJqDBN3Pn\r
56         gwwuSURISTUwtse8OR8q+sLwq9fHdwZPs5XiQuq0PnrzXZpRMmXmwuAem/1nb5zhlj+W9+y8\r
57         otl3P69V8i8ab5usXqXdqT1DOF8l6bqxcuwMTl97K/k3mitDMruk4rriV64L5+S6tnDxoj1C\r
58         OxsuqKnzphtMnSZ7dQufSEr63Waz2yzfki8KutWvLFqtI8mqxFKckWioxVxUnAgAmvmhVNYC        AAA=\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Sun, 26 May 2013 06:35:13 -0000\r
72 \r
73 Previously, notmuch-show-view-part overrode the function binding of\r
74 mm-show-part to redirect it to notmuch-show-save-part to get notmuch's\r
75 default file name handling in case mm-display-part decided to fall\r
76 back to saving the part.  In addition to being messy, this depended on\r
77 the now-deprecated dynamic binding behavior of flet.\r
78 \r
79 This patch removes the mm-show-part override in favor of passing the\r
80 file name in to mm-show-part the way it expects, so we get its default\r
81 file name handling.  It's not clear why we didn't do this before;\r
82 mm-show-part has supported default file names since at least Emacs\r
83 23.1.\r
84 ---\r
85 This version overrides the default save directory to make it\r
86 consistent with `notmuch-show-save-part'.\r
87 \r
88  emacs/notmuch-show.el |   23 +++++++++--------------\r
89  1 file changed, 9 insertions(+), 14 deletions(-)\r
90 \r
91 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
92 index 423dd58..d773396 100644\r
93 --- a/emacs/notmuch-show.el\r
94 +++ b/emacs/notmuch-show.el\r
95 @@ -528,20 +528,15 @@ message at DEPTH in the current thread."\r
96  \r
97  (defun notmuch-show-view-part (message-id nth &optional filename content-type )\r
98    (notmuch-with-temp-part-buffer message-id nth\r
99 -    ;; set mm-inlined-types to nil to force an external viewer\r
100 -    (let ((handle (mm-make-handle (current-buffer) (list content-type)))\r
101 -         (mm-inlined-types nil))\r
102 -      ;; We override mm-save-part as notmuch-show-save-part is better\r
103 -      ;; since it offers the filename. We need to lexically bind\r
104 -      ;; everything we need for notmuch-show-save-part to prevent\r
105 -      ;; potential dynamic shadowing.\r
106 -      (lexical-let ((message-id message-id)\r
107 -                   (nth nth)\r
108 -                   (filename filename)\r
109 -                   (content-type content-type))\r
110 -       (flet ((mm-save-part (&rest args) (notmuch-show-save-part\r
111 -                                          message-id nth filename content-type)))\r
112 -         (mm-display-part handle))))))\r
113 +    (let* ((disposition (if filename `(attachment (filename . ,filename))))\r
114 +          (handle (mm-make-handle (current-buffer) (list content-type)\r
115 +                                  nil nil disposition))\r
116 +          ;; Set the default save directory to be consistent with\r
117 +          ;; `notmuch-show-save-part'.\r
118 +          (mm-default-directory (or mailcap-download-directory "~/"))\r
119 +          ;; set mm-inlined-types to nil to force an external viewer\r
120 +          (mm-inlined-types nil))\r
121 +      (mm-display-part handle))))\r
122  \r
123  (defun notmuch-show-interactively-view-part (message-id nth &optional filename content-type)\r
124    (notmuch-with-temp-part-buffer message-id nth\r
125 -- \r
126 1.7.10.4\r
127 \r