From: Dirk Hohndel <hohndel@infradead.org>
To: Carl Worth <cworth@cworth.org>, David Edmondson <dme@dme.org>,
notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: More DWIM when editing messages
Date: Mon, 26 Apr 2010 10:46:01 -0700 [thread overview]
Message-ID: <m3wrvugl9i.fsf@x200.gr8dns.org> (raw)
In-Reply-To: <87d3xmdsxq.fsf@yoom.home.cworth.org>
On Mon, 26 Apr 2010 10:28:33 -0700, Carl Worth <cworth@cworth.org> wrote:
> On Mon, 26 Apr 2010 09:31:49 -0700, Dirk Hohndel <hohndel@infradead.org> wrote:
> > On Mon, 26 Apr 2010 15:01:25 +0100, David Edmondson <dme@dme.org> wrote:
> > > For composing new messages and forwarding, leave the cursor on the
> > > 'To:' field. For replies, leave the cursor at the start of the
> > > body. In all cases, mark the buffer as not modified so that the user
> > > is not prompted if she decides to immediately kill the buffer.
> >
> > YES! Brilliant. I didn't realize how much I wanted it till you sent
> > this. Carl, please include in 0.3
>
> Agreed! This is *so* pleasant.
>
> Thanks, David! This is pushed.
And here is the promised fix to get signature in the correct spot:
From cbd9c96450f6481433877410bcf075d482b4be1b Mon Sep 17 00:00:00 2001
From: Dirk Hohndel <hohndel@infradead.org>
Date: Mon, 26 Apr 2010 10:41:49 -0700
Subject: [PATCH] Put signatures at the very end of the message
The existing code inserts the signature before inserting the message
body (which it puts at the very end of the buffer - therefore AFTER
the signature). This little snippet makes us search backwards and
insert the message body before a signature, if it exists.
This also fixes a small indentation issue in David's code.
Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
---
emacs/notmuch-mua.el | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index c7a9aee..9fbb94a 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -98,11 +98,16 @@ list."
collect header)))
(message-sort-headers)
(message-hide-headers)
+ ;; insert the message body - but put it in front of the signature
+ ;; if one is present
(goto-char (point-max))
+ (if (re-search-backward "-- " nil t)
+ (forward-line -1)
+ (goto-char (point-max)))
(insert body))
- (set-buffer-modified-p nil)
+ (set-buffer-modified-p nil)
- (message-goto-body))
+ (message-goto-body))
(defun notmuch-mua-forward-message ()
(message-forward)
--
1.6.6.1
--
Dirk Hohndel
Intel Open Source Technology Center
next prev parent reply other threads:[~2010-04-26 22:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-26 14:01 [PATCH] emacs: More DWIM when editing messages David Edmondson
2010-04-26 16:31 ` Dirk Hohndel
2010-04-26 17:28 ` Carl Worth
2010-04-26 17:46 ` Dirk Hohndel [this message]
2010-04-26 22:28 ` Dirk Hohndel
2010-04-26 23:39 ` Carl Worth
2010-04-27 1:52 ` Dirk Hohndel
2010-04-27 5:34 ` David Edmondson
2010-04-27 6:14 ` Carl Worth
2010-04-27 15:22 ` Dirk Hohndel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3wrvugl9i.fsf@x200.gr8dns.org \
--to=hohndel@infradead.org \
--cc=cworth@cworth.org \
--cc=dme@dme.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).