unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Geoffrey Ferrari <geoffrey.ferrari@oriel.oxon.org>,
	notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
Date: Wed, 28 Aug 2013 21:53:37 +0300	[thread overview]
Message-ID: <m2ob8hy7da.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <m2sixtyb5k.fsf@guru.guru-group.fi>

On Wed, Aug 28 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:

> On Thu, Aug 08 2013, Geoffrey Ferrari <geoffrey.ferrari@oriel.oxon.org> wrote:
>
>> From: "Geoffrey H. Ferrari" <geoffrey.ferrari@oriel.oxon.org>
>>
>> When composing a reply, notmuch-mua-reply tries to be smart and cite
>> the original message by inserting it before the user signature, if
>> one is present. However, the existing method of backward searching
>> from the end of the buffer to find the signature separator and then
>> moving one line up results in the original message being cited in
>> the message headers. That's because at this point the message looks
>> like this (with | representing point after searching for the
>> signature separator):
>>
>> From: xxx
>> To: xxx
>> Subject: xxx
>> --text follows this line--
>> |--
>> My fancy signature
>
> Now that I tested, (with ~/.signature), composing new mail starts with
>
> --8<---8<---8<---8<---8<---8<---8<---8<---8<-
> From: Tomi Ollila <tomi.ollila@iki.fi>
> To:
> Subject: 
> Fcc: /home/too/mail/mails/sent
> --text follows this line--
>
> --
> signature
> --8<---8<---8<---8<---8<---8<---8<---8<---8<-
>
> Notice the empty line between '--text follows this line--' and '--'
>
> In your example, the signature block is -- for some reason --
> inserted without the empty line.
>
>> With this patch, a newline is opened instead, so that the orignal
>> message is cited above the signature but still in the message text.

....

>>       (goto-char (point-max))
>>       (if (re-search-backward message-signature-separator nil t)
>>-	  (forward-line -1)
>>+	  (newline)
>>	(goto-char (point-max)))

If the case is like I think, it should have used (open-line 1) instead.

Anyway, what about:

    (goto-char (point-max))
    (when (re-search-backward message-signature-separator nil t)
      (forward-line -1)
      (unless (eolp)
        (end-of-line)
        (newline)))

The else clause with (goto-char (point-max)) is unnecessary as 
with the third argument NOERROR being t point is moved if
re-search-backward doesn't find match.

>> ---
>
> Tomi

Tomi

  reply	other threads:[~2013-08-28 18:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08 11:35 [PATCH] emacs: bugfix notmuch-mua-reply when signature is present Geoffrey Ferrari
2013-08-09  8:19 ` Tomi Ollila
2013-08-19 14:29   ` Tomi Ollila
2013-08-26 17:58     ` Jani Nikula
2013-08-28 17:31 ` Tomi Ollila
2013-08-28 18:53   ` Tomi Ollila [this message]
2013-08-28 19:37     ` Jani Nikula
2013-08-28 20:14       ` Jani Nikula
2013-08-28 20:46       ` Tomi Ollila

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=m2ob8hy7da.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=geoffrey.ferrari@oriel.oxon.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).