unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
@ 2013-08-08 11:35 Geoffrey Ferrari
  2013-08-09  8:19 ` Tomi Ollila
  2013-08-28 17:31 ` Tomi Ollila
  0 siblings, 2 replies; 9+ messages in thread
From: Geoffrey Ferrari @ 2013-08-08 11:35 UTC (permalink / raw)
  To: notmuch; +Cc: Geoffrey H. Ferrari

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

With this patch, a newline is opened instead, so that the orignal
message is cited above the signature but still in the message text.
---
 emacs/notmuch-mua.el |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 2baae5f..86f164d 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -194,7 +194,7 @@ list."
       ;; if one is present
       (goto-char (point-max))
       (if (re-search-backward message-signature-separator nil t)
-	  (forward-line -1)
+	  (newline)
 	(goto-char (point-max)))
 
       (let ((from (plist-get original-headers :From))
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
  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-28 17:31 ` Tomi Ollila
  1 sibling, 1 reply; 9+ messages in thread
From: Tomi Ollila @ 2013-08-09  8:19 UTC (permalink / raw)
  To: Geoffrey Ferrari, notmuch

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
>
> With this patch, a newline is opened instead, so that the orignal
> message is cited above the signature but still in the message text.
> ---

This probably fixes #1 in id:8762auwgfl.fsf@steelpick.2x.cz

( http://mid.gmane.org/8762auwgfl.fsf@steelpick.2x.cz )

... I just noticed I have no clue how to set message signature to test
this... ;/


Tomi



>  emacs/notmuch-mua.el |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 2baae5f..86f164d 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -194,7 +194,7 @@ list."
>        ;; if one is present
>        (goto-char (point-max))
>        (if (re-search-backward message-signature-separator nil t)
> -	  (forward-line -1)
> +	  (newline)
>  	(goto-char (point-max)))
>  
>        (let ((from (plist-get original-headers :From))
> -- 
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
  2013-08-09  8:19 ` Tomi Ollila
@ 2013-08-19 14:29   ` Tomi Ollila
  2013-08-26 17:58     ` Jani Nikula
  0 siblings, 1 reply; 9+ messages in thread
From: Tomi Ollila @ 2013-08-19 14:29 UTC (permalink / raw)
  To: Geoffrey Ferrari, notmuch

On Fri, Aug 09 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
>>
>> With this patch, a newline is opened instead, so that the orignal
>> message is cited above the signature but still in the message text.
>> ---
>
> This probably fixes #1 in id:8762auwgfl.fsf@steelpick.2x.cz
>
> ( http://mid.gmane.org/8762auwgfl.fsf@steelpick.2x.cz )
>
> ... I just noticed I have no clue how to set message signature to test
> this... ;/

Now I tried something fancy and executed `echo foobar > ~/.signature`

Now I get the "--\nfoobar" at the end of all emails I'm, composing -- but
I don't see any problems when replying... so I'd be interested to see
in what circumstances could I get the problem this patch solves exposed.

>
> Tomi

Tomi


>
>
>
>>  emacs/notmuch-mua.el |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
>> index 2baae5f..86f164d 100644
>> --- a/emacs/notmuch-mua.el
>> +++ b/emacs/notmuch-mua.el
>> @@ -194,7 +194,7 @@ list."
>>        ;; if one is present
>>        (goto-char (point-max))
>>        (if (re-search-backward message-signature-separator nil t)
>> -	  (forward-line -1)
>> +	  (newline)
>>  	(goto-char (point-max)))
>>  
>>        (let ((from (plist-get original-headers :From))
>> -- 
>> 1.7.10.4
>>
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
  2013-08-19 14:29   ` Tomi Ollila
@ 2013-08-26 17:58     ` Jani Nikula
  0 siblings, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2013-08-26 17:58 UTC (permalink / raw)
  To: Tomi Ollila, Geoffrey Ferrari, notmuch

On Mon, 19 Aug 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Fri, Aug 09 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
>>>
>>> With this patch, a newline is opened instead, so that the orignal
>>> message is cited above the signature but still in the message text.
>>> ---
>>
>> This probably fixes #1 in id:8762auwgfl.fsf@steelpick.2x.cz
>>
>> ( http://mid.gmane.org/8762auwgfl.fsf@steelpick.2x.cz )
>>
>> ... I just noticed I have no clue how to set message signature to test
>> this... ;/
>
> Now I tried something fancy and executed `echo foobar > ~/.signature`
>
> Now I get the "--\nfoobar" at the end of all emails I'm, composing -- but
> I don't see any problems when replying... so I'd be interested to see
> in what circumstances could I get the problem this patch solves exposed.

Hi Geoffrey, we can't reproduce the issue this patch claims to fix. Care
to provide more info please?

BR,
Jani.


>
>>
>> Tomi
>
> Tomi
>
>
>>
>>
>>
>>>  emacs/notmuch-mua.el |    2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
>>> index 2baae5f..86f164d 100644
>>> --- a/emacs/notmuch-mua.el
>>> +++ b/emacs/notmuch-mua.el
>>> @@ -194,7 +194,7 @@ list."
>>>        ;; if one is present
>>>        (goto-char (point-max))
>>>        (if (re-search-backward message-signature-separator nil t)
>>> -	  (forward-line -1)
>>> +	  (newline)
>>>  	(goto-char (point-max)))
>>>  
>>>        (let ((from (plist-get original-headers :From))
>>> -- 
>>> 1.7.10.4
>>>
>>> _______________________________________________
>>> notmuch mailing list
>>> notmuch@notmuchmail.org
>>> http://notmuchmail.org/mailman/listinfo/notmuch
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
  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-28 17:31 ` Tomi Ollila
  2013-08-28 18:53   ` Tomi Ollila
  1 sibling, 1 reply; 9+ messages in thread
From: Tomi Ollila @ 2013-08-28 17:31 UTC (permalink / raw)
  To: Geoffrey Ferrari, notmuch

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.
> ---


Tomi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
  2013-08-28 17:31 ` Tomi Ollila
@ 2013-08-28 18:53   ` Tomi Ollila
  2013-08-28 19:37     ` Jani Nikula
  0 siblings, 1 reply; 9+ messages in thread
From: Tomi Ollila @ 2013-08-28 18:53 UTC (permalink / raw)
  To: Geoffrey Ferrari, notmuch

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
  2013-08-28 18:53   ` Tomi Ollila
@ 2013-08-28 19:37     ` Jani Nikula
  2013-08-28 20:14       ` Jani Nikula
  2013-08-28 20:46       ` Tomi Ollila
  0 siblings, 2 replies; 9+ messages in thread
From: Jani Nikula @ 2013-08-28 19:37 UTC (permalink / raw)
  To: Tomi Ollila, Geoffrey Ferrari, notmuch

On Wed, 28 Aug 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> 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:

Hi Tomi, what about [1] instead? KISS and all that.

Cheers,
Jani.

[1] id:cover.1377718199.git.jani@nikula.org


>
>     (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
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

-- 
whoaaa 

asdfasfd

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
  2013-08-28 19:37     ` Jani Nikula
@ 2013-08-28 20:14       ` Jani Nikula
  2013-08-28 20:46       ` Tomi Ollila
  1 sibling, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2013-08-28 20:14 UTC (permalink / raw)
  To: Tomi Ollila, Geoffrey Ferrari, notmuch

On Wed, 28 Aug 2013, Jani Nikula <jani@nikula.org> wrote:
> -- 
> whoaaa 
>
> asdfasfd

And this is me toying with the signature that I don't usually
have... oops. :)

Cheers,
Jani.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] emacs: bugfix notmuch-mua-reply when signature is present
  2013-08-28 19:37     ` Jani Nikula
  2013-08-28 20:14       ` Jani Nikula
@ 2013-08-28 20:46       ` Tomi Ollila
  1 sibling, 0 replies; 9+ messages in thread
From: Tomi Ollila @ 2013-08-28 20:46 UTC (permalink / raw)
  To: Jani Nikula, Geoffrey Ferrari, notmuch

On Wed, Aug 28 2013, Jani Nikula <jani@nikula.org> wrote:

> On Wed, 28 Aug 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:
>> 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:
>
> Hi Tomi, what about [1] instead? KISS and all that.

Indeed, I just looked that. Looks Good. Will test tomorrow...

>
> Cheers,
> Jani.

Tomi

PS: my test signature intentionally left there ;)

>
> [1] id:cover.1377718199.git.jani@nikula.org
>
>
>>
>>     (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
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
>
> -- 
> whoaaa 
>
> asdfasfd
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>

-- 
foobar

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-08-28 20:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-08-28 19:37     ` Jani Nikula
2013-08-28 20:14       ` Jani Nikula
2013-08-28 20:46       ` Tomi Ollila

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).