Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 0C244431FDD for ; Thu, 5 Sep 2013 07:22:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ru8DjhWrlEq5 for ; Thu, 5 Sep 2013 07:22:29 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 7EBE7431FDB for ; Thu, 5 Sep 2013 07:22:29 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id D3BFA10005E; Thu, 5 Sep 2013 17:22:21 +0300 (EEST) From: Tomi Ollila To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH 1/1] emacs: fix notmuch-mua-reply point placement when signature involved In-Reply-To: <87d2one4u0.fsf@nikula.org> References: <1378322458-30159-1-git-send-email-tomi.ollila@iki.fi> <87d2one4u0.fsf@nikula.org> User-Agent: Notmuch/0.16+60~gbdcc747 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 14:22:36 -0000 On Thu, Sep 05 2013, Jani Nikula wrote: > On Wed, 04 Sep 2013, "Tomi.Ollila" wrote: >> From: Tomi Ollila >> >> When composing a reply, notmuch-mua-reply attempts to cite the >> the original message by inserting it before the user signature, if >> one is present. The existing method used to search the signature >> separator backward from the end of the buffer and then move one >> line up. In case of variable `message-signature-insert-empty-line' >> being nil (and `message-signature-setup-hook' not intervening) this >> caused point to go to the beginning of '--text follows this line--' >> separator line, and citation was inserted there. >> This change checks the value of `message-signature-insert-empty-line' >> and doesn't move point if that is nil. Additional narrowing to >> the body region ensures that point never goes to the separator line >> (or beyond). >> >> Original patch from "Geoffrey H. Ferrari", continued with iterations >> from Jani and Mark. > > Hi Tomi, I don't think you've sufficiently convinced me why we need all > this complexity instead of just doing [1]. And if you do get me > convinced, I'd like the reason to be in the commit message and in a > comment above the piece of code in question. (add-hook 'message-signature-setup-hook=20 (lambda () (insert "Insert this text before the citation not after.\n"))) >From emacs documentation: message-signature-setup-hook is a variable defined in `message.el'. Its value is nil This variable may be risky if used as a file-local variable. Documentation: Normal hook, run each time a new outgoing message is initialized. It is run after the headers have been inserted and before the signature is inserted. You can customize this variable. Adding the comments is a good idea -- if the above convinces you I'll prepare comments along this idea. > Cheers, > Jani. Tomi > > > [1] id:cover.1377718199.git.jani@nikula.org > > > > >> --- >> emacs/notmuch-mua.el | 12 ++++++++---- >> 1 file changed, 8 insertions(+), 4 deletions(-) >> >> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el >> index 2baae5f..0280c9f 100644 >> --- a/emacs/notmuch-mua.el >> +++ b/emacs/notmuch-mua.el >> @@ -192,10 +192,14 @@ list." >>=20=20 >> ;; Insert the message body - but put it in front of the signature >> ;; if one is present >> - (goto-char (point-max)) >> - (if (re-search-backward message-signature-separator nil t) >> - (forward-line -1) >> - (goto-char (point-max))) >> + (save-restriction >> + (message-goto-body) >> + (narrow-to-region (point) (point-max)) >> + (goto-char (point-max)) >> + (if (re-search-backward message-signature-separator nil t) >> + (if message-signature-insert-empty-line >> + (forward-line -1)) >> + (goto-char (point-max)))) >>=20=20 >> (let ((from (plist-get original-headers :From)) >> (date (plist-get original-headers :Date)) >> --=20 >> 1.8.0 >> >> _______________________________________________ >> notmuch mailing list >> notmuch@notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch > --=20 "kaik on m=C3=A4nt!"