Re: [PATCH v2] emacs: Support a message-mode switch function in notmuch-mua
authorJani Nikula <jani@nikula.org>
Tue, 18 Oct 2011 18:58:02 +0000 (21:58 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:39:41 +0000 (09:39 -0800)
d8/c6b052e1cffd9740e31456257e3419690002d5 [new file with mode: 0644]

diff --git a/d8/c6b052e1cffd9740e31456257e3419690002d5 b/d8/c6b052e1cffd9740e31456257e3419690002d5
new file mode 100644 (file)
index 0000000..d5302ea
--- /dev/null
@@ -0,0 +1,135 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 288FE429E26\r
+       for <notmuch@notmuchmail.org>; Tue, 18 Oct 2011 11:58:10 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id pR0asbpmO1zx for <notmuch@notmuchmail.org>;\r
+       Tue, 18 Oct 2011 11:58:09 -0700 (PDT)\r
+Received: from mail-vx0-f181.google.com (mail-vx0-f181.google.com\r
+       [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 71EDD429E25\r
+       for <notmuch@notmuchmail.org>; Tue, 18 Oct 2011 11:58:09 -0700 (PDT)\r
+Received: by vcbfk14 with SMTP id fk14so953285vcb.26\r
+       for <notmuch@notmuchmail.org>; Tue, 18 Oct 2011 11:58:07 -0700 (PDT)\r
+Received: by 10.52.38.4 with SMTP id c4mr3779705vdk.123.1318964287613;\r
+       Tue, 18 Oct 2011 11:58:07 -0700 (PDT)\r
+Received: from doommachine (bensakone.com. [92.243.29.139])\r
+       by mx.google.com with ESMTPS id hl5sm2840795vdb.18.2011.10.18.11.58.04\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 18 Oct 2011 11:58:05 -0700 (PDT)\r
+Date: Tue, 18 Oct 2011 21:58:02 +0300 (EEST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Thomas Jost <schnouki@schnouki.net>\r
+Subject: Re: [PATCH v2] emacs: Support a message-mode switch function in\r
+       notmuch-mua\r
+In-Reply-To: <1318362674-17652-1-git-send-email-schnouki@schnouki.net>\r
+Message-ID: <alpine.DEB.2.00.1110182144360.2880@qbbzznpuvar>\r
+References: <8739eztijn.fsf@schnouki.net>\r
+       <1318362674-17652-1-git-send-email-schnouki@schnouki.net>\r
+User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)\r
+MIME-Version: 1.0\r
+Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 18 Oct 2011 18:58:10 -0000\r
+\r
+\r
+Hi Thomas -\r
+\r
+AFAICT :options is not meaningful for a function type. I think you should \r
+use choice type for this instead. This allows sensible documentation for \r
+the choices in the customization interface too.\r
+\r
+I sent a patch earlier to fix a similar issue [1], please have a look at \r
+that for an example. (Unfortunately, it hasn't been applied, like many \r
+other emacs patches by me and others. I hope yours will make it. I've \r
+given up trying until I see some progress in that front.)\r
+\r
+[1] http://permalink.gmane.org/gmane.mail.notmuch.general/5602\r
+\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+On Tue, 11 Oct 2011, Thomas Jost wrote:\r
+\r
+> ---\r
+> emacs/notmuch-mua.el |   21 +++++++++++++++++++--\r
+> 1 files changed, 19 insertions(+), 2 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+> index 8824b08..639407f 100644\r
+> --- a/emacs/notmuch-mua.el\r
+> +++ b/emacs/notmuch-mua.el\r
+> @@ -31,6 +31,20 @@\r
+>   :group 'notmuch\r
+>   :type 'hook)\r
+>\r
+> +(defcustom notmuch-mua-switch-function nil\r
+> +  "Function used to switch to and display a new mail buffer. If\r
+> +this is `nil' then the buffer will be displayed in the current\r
+> +window. Other common values are `switch-to-buffer-other-frame'\r
+> +and `switch-to-buffer-other-window'. If you change this, you may\r
+> +also want to change `message-sent-hook' accordingly:\r
+> +    (setq notmuch-muas-witch-function 'switch-to-buffer-other-frame)\r
+> +    (add-hook 'message-sent-hook '(delete-frame))"\r
+> +  :group 'notmuch\r
+> +  :type 'function\r
+> +  :options '(nil\r
+> +         switch-to-buffer-other-frame\r
+> +         switch-to-buffer-other-window))\r
+> +\r
+> (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full\r
+>   "Function used to generate a `User-Agent:' string. If this is\r
+> `nil' then no `User-Agent:' will be generated."\r
+> @@ -99,7 +113,8 @@ list."\r
+>      ((same-window-regexps '("\\*mail .*")))\r
+>       (notmuch-mua-mail (mail-header 'to headers)\r
+>                      (mail-header 'subject headers)\r
+> -                    (message-headers-to-generate headers t '(to subject))))\r
+> +                    (message-headers-to-generate headers t '(to subject))\r
+> +                    nil notmuch-mua-switch-function))\r
+>     ;; insert the message body - but put it in front of the signature\r
+>     ;; if one is present\r
+>     (goto-char (point-max))\r
+> @@ -112,6 +127,8 @@ list."\r
+>   (message-goto-body))\r
+>\r
+> (defun notmuch-mua-forward-message ()\r
+> +  (when notmuch-mua-switch-function\r
+> +    (funcall notmuch-mua-switch-function (current-buffer)))\r
+>   (message-forward)\r
+>\r
+>   (when notmuch-mua-user-agent-function\r
+> @@ -199,7 +216,7 @@ the From: address first."\r
+>   (let ((other-headers\r
+>       (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
+>         (list (cons 'from (notmuch-mua-prompt-for-sender))))))\r
+> -    (notmuch-mua-mail nil nil other-headers)))\r
+> +    (notmuch-mua-mail nil nil other-headers nil notmuch-mua-switch-function)))\r
+>\r
+> (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
+>   "Invoke the notmuch message forwarding window.\r
+>\r