Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 7c / 56b7cc9a91b8df83ce360418d602b22b7bdcbf
1 Return-Path: <schnouki@schnouki.net>\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 AB5F6429E25\r
6         for <notmuch@notmuchmail.org>; Tue, 11 Oct 2011 12:51:38 -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.1\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id GoqMQviCDqvt for <notmuch@notmuchmail.org>;\r
17         Tue, 11 Oct 2011 12:51:38 -0700 (PDT)\r
18 Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
19         by olra.theworths.org (Postfix) with ESMTP id 32840431FB6\r
20         for <notmuch@notmuchmail.org>; Tue, 11 Oct 2011 12:51:38 -0700 (PDT)\r
21 Received: from localhost.localdomain (nancy.schnouki.net [78.238.0.45])\r
22         by ks3536.kimsufi.com (Postfix) with ESMTPSA id 67D886A06A9;\r
23         Tue, 11 Oct 2011 21:51:37 +0200 (CEST)\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
25         s=key-schnouki; t=1318362697;\r
26         bh=6toTTnsBDw5AdgYTV3Mt8TAerlDNB+Woj1ns2zOHxZA=;\r
27         h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
28         b=EuYXJCTN2m4Ck0SmVqZ6mAb+5GMOer/yy7Ae7JIwn1T32wwvSih5ppEH5oiucBKw9\r
29         jqK7AdVeQgPIOGuBqmaaxXAYgt830psHGY3YMVW5GjsySw/mc/9y3FJBekQeyC0/Ez\r
30         icnJIM0F7zOiLVmCk/HcNBVkGzrSNpHaDyaCCKmg=\r
31 From: Thomas Jost <schnouki@schnouki.net>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH v2] emacs: Support a message-mode switch function in\r
34         notmuch-mua\r
35 Date: Tue, 11 Oct 2011 21:51:14 +0200\r
36 Message-Id: <1318362674-17652-1-git-send-email-schnouki@schnouki.net>\r
37 X-Mailer: git-send-email 1.7.7\r
38 In-Reply-To: <8739eztijn.fsf@schnouki.net>\r
39 References: <8739eztijn.fsf@schnouki.net>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Tue, 11 Oct 2011 19:51:38 -0000\r
53 \r
54 ---\r
55  emacs/notmuch-mua.el |   21 +++++++++++++++++++--\r
56  1 files changed, 19 insertions(+), 2 deletions(-)\r
57 \r
58 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
59 index 8824b08..639407f 100644\r
60 --- a/emacs/notmuch-mua.el\r
61 +++ b/emacs/notmuch-mua.el\r
62 @@ -31,6 +31,20 @@\r
63    :group 'notmuch\r
64    :type 'hook)\r
65  \r
66 +(defcustom notmuch-mua-switch-function nil\r
67 +  "Function used to switch to and display a new mail buffer. If\r
68 +this is `nil' then the buffer will be displayed in the current\r
69 +window. Other common values are `switch-to-buffer-other-frame'\r
70 +and `switch-to-buffer-other-window'. If you change this, you may\r
71 +also want to change `message-sent-hook' accordingly:\r
72 +    (setq notmuch-muas-witch-function 'switch-to-buffer-other-frame)\r
73 +    (add-hook 'message-sent-hook '(delete-frame))"\r
74 +  :group 'notmuch\r
75 +  :type 'function\r
76 +  :options '(nil\r
77 +            switch-to-buffer-other-frame\r
78 +            switch-to-buffer-other-window))\r
79 +\r
80  (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full\r
81    "Function used to generate a `User-Agent:' string. If this is\r
82  `nil' then no `User-Agent:' will be generated."\r
83 @@ -99,7 +113,8 @@ list."\r
84         ((same-window-regexps '("\\*mail .*")))\r
85        (notmuch-mua-mail (mail-header 'to headers)\r
86                         (mail-header 'subject headers)\r
87 -                       (message-headers-to-generate headers t '(to subject))))\r
88 +                       (message-headers-to-generate headers t '(to subject))\r
89 +                       nil notmuch-mua-switch-function))\r
90      ;; insert the message body - but put it in front of the signature\r
91      ;; if one is present\r
92      (goto-char (point-max))\r
93 @@ -112,6 +127,8 @@ list."\r
94    (message-goto-body))\r
95  \r
96  (defun notmuch-mua-forward-message ()\r
97 +  (when notmuch-mua-switch-function\r
98 +    (funcall notmuch-mua-switch-function (current-buffer)))\r
99    (message-forward)\r
100  \r
101    (when notmuch-mua-user-agent-function\r
102 @@ -199,7 +216,7 @@ the From: address first."\r
103    (let ((other-headers\r
104          (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
105            (list (cons 'from (notmuch-mua-prompt-for-sender))))))\r
106 -    (notmuch-mua-mail nil nil other-headers)))\r
107 +    (notmuch-mua-mail nil nil other-headers nil notmuch-mua-switch-function)))\r
108  \r
109  (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
110    "Invoke the notmuch message forwarding window.\r
111 -- \r
112 1.7.7\r
113 \r