Re: [PATCH] emacs: Let the user choose where to compose new mails
authorTomi Ollila <tomi.ollila@iki.fi>
Sat, 28 Apr 2012 07:23:05 +0000 (10:23 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:46 +0000 (09:46 -0800)
57/e49a1f551f3e8361b7c1ff280fa69a2705a8c6 [new file with mode: 0644]

diff --git a/57/e49a1f551f3e8361b7c1ff280fa69a2705a8c6 b/57/e49a1f551f3e8361b7c1ff280fa69a2705a8c6
new file mode 100644 (file)
index 0000000..53c0301
--- /dev/null
@@ -0,0 +1,174 @@
+Return-Path: <tomi.ollila@iki.fi>\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 B2C9B431FAF\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 00:23:14 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       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 KoW9V2BA7qEx for <notmuch@notmuchmail.org>;\r
+       Sat, 28 Apr 2012 00:23:12 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])\r
+       by olra.theworths.org (Postfix) with ESMTP id 59CA9431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 00:23:12 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id E061D68055; Sat, 28 Apr 2012 10:23:05 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
+       Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH] emacs: Let the user choose where to compose new mails\r
+In-Reply-To: <1334434815-7657-1-git-send-email-jrollins@finestructure.net>\r
+References: <87pqbayukw.fsf@servo.finestructure.net>\r
+       <1334434815-7657-1-git-send-email-jrollins@finestructure.net>\r
+User-Agent: Notmuch/0.12+128~g512e176 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sat, 28 Apr 2012 10:23:05 +0300\r
+Message-ID: <m2ty049v6u.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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: Sat, 28 Apr 2012 07:23:14 -0000\r
+\r
+On Sat, Apr 14 2012, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
+\r
+> From: Thomas Jost <schnouki@schnouki.net>\r
+>\r
+> Introduce a new defcustom notmuch-mua-compose-in that allows users to\r
+> specify where new mails are composed., either in the current window or\r
+> in a new window or frame.\r
+>\r
+> Signed-off-by: Jameson Rollins <jrollins@finestructure.net>\r
+> ---\r
+> This is a rebase of this original patch against the current master,\r
+> with an expanded commit message.\r
+\r
++1\r
+\r
+Tomi\r
+\r
+>\r
+>  emacs/notmuch-mua.el |   42 +++++++++++++++++++++++++++++++++++++++---\r
+>  1 file changed, 39 insertions(+), 3 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+> index 87bd88d..a96ac3d 100644\r
+> --- a/emacs/notmuch-mua.el\r
+> +++ b/emacs/notmuch-mua.el\r
+> @@ -36,6 +36,21 @@\r
+>    :group 'notmuch-send\r
+>    :group 'notmuch-hooks)\r
+>  \r
+> +(defcustom notmuch-mua-compose-in 'current-window\r
+> +  "Where to create the mail buffer used to compose a new message.\r
+> +  Possible values are `current-window' (default), `new-window'\r
+> +  and `new-frame'. If set to `current-window', the mail buffer\r
+> +  will be displayed in the current window, so the old buffer will\r
+> +  be restored when the mail buffer is killed. If set to\r
+> +  `new-window' or `new-frame', the mail buffer will be displayed\r
+> +  in a new window/frame that will be destroyed when the buffer is\r
+> +  killed. You may want to customize `message-kill-buffer-on-exit'\r
+> +  accordingly."\r
+> +  :group 'notmuch\r
+> +  :type '(choice (const :tag "Compose in the current window" current-window)\r
+> +             (const :tag "Compose mail in a new window"  new-window)\r
+> +             (const :tag "Compose mail in a new frame"   new-frame)))\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
+> @@ -55,6 +70,23 @@ list."\r
+>  \r
+>  ;;\r
+>  \r
+> +(defun notmuch-mua-get-switch-function ()\r
+> +  "Get a switch function according to `notmuch-mua-compose-in'."\r
+> +  (cond ((eq notmuch-mua-compose-in 'current-window)\r
+> +     'switch-to-buffer)\r
+> +    ((eq notmuch-mua-compose-in 'new-window)\r
+> +     'switch-to-buffer-other-window)\r
+> +    ((eq notmuch-mua-compose-in 'new-frame)\r
+> +     'switch-to-buffer-other-frame)\r
+> +    (t (error "Invalid value for `notmuch-mua-compose-in'"))))\r
+> +\r
+> +(defun notmuch-mua-maybe-set-window-dedicated ()\r
+> +  "Set the selected window as dedicated according to\r
+> +`notmuch-mua-compose-in'."\r
+> +  (when (or (eq notmuch-mua-compose-in 'new-frame)\r
+> +        (eq notmuch-mua-compose-in 'new-window))\r
+> +    (set-window-dedicated-p (selected-window) t)))\r
+> +\r
+>  (defun notmuch-mua-user-agent-full ()\r
+>    "Generate a `User-Agent:' string suitable for notmuch."\r
+>    (concat (notmuch-mua-user-agent-notmuch)\r
+> @@ -148,7 +180,8 @@ list."\r
+>                   collect pair)))\r
+>        (notmuch-mua-mail (plist-get reply-headers :To)\r
+>                          (plist-get reply-headers :Subject)\r
+> -                        (notmuch-headers-plist-to-alist reply-headers))))\r
+> +                        (notmuch-headers-plist-to-alist reply-headers)\r
+> +                        nil (notmuch-mua-get-switch-function))))\r
+>  \r
+>        ;; Insert the message body - but put it in front of the signature\r
+>        ;; if one is present\r
+> @@ -186,6 +219,7 @@ list."\r
+>    (set-buffer-modified-p nil))\r
+>  \r
+>  (defun notmuch-mua-forward-message ()\r
+> +  (funcall (notmuch-mua-get-switch-function) (current-buffer))\r
+>    (message-forward)\r
+>  \r
+>    (when notmuch-mua-user-agent-function\r
+> @@ -195,6 +229,7 @@ list."\r
+>    (message-sort-headers)\r
+>    (message-hide-headers)\r
+>    (set-buffer-modified-p nil)\r
+> +  (notmuch-mua-maybe-set-window-dedicated)\r
+>  \r
+>    (message-goto-to))\r
+>  \r
+> @@ -217,6 +252,7 @@ OTHER-ARGS are passed through to `message-mail'."\r
+>    (message-sort-headers)\r
+>    (message-hide-headers)\r
+>    (set-buffer-modified-p nil)\r
+> +  (notmuch-mua-maybe-set-window-dedicated)\r
+>  \r
+>    (message-goto-to))\r
+>  \r
+> @@ -272,8 +308,8 @@ the From: address first."\r
+>    (interactive "P")\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
+> +       (list (cons "From" (notmuch-mua-prompt-for-sender))))))\r
+> +    (notmuch-mua-mail nil nil other-headers nil (notmuch-mua-get-switch-function))))\r
+>  \r
+>  (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
+>    "Invoke the notmuch message forwarding window.\r
+> -- \r
+> 1.7.9.5\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r