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 1F04C431FDD for ; Thu, 5 Sep 2013 07:11:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 29aQ+Tc1CBSp for ; Thu, 5 Sep 2013 07:11:28 -0700 (PDT) Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id BFC1C431FDB for ; Thu, 5 Sep 2013 07:11:27 -0700 (PDT) Received: by mail-we0-f176.google.com with SMTP id u56so1770029wes.7 for ; Thu, 05 Sep 2013 07:11:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=4HWZEFPntxflgkxmTXydijjqRv/QcW6Rll1HM5o91zI=; b=T96K0czwy8Pzag+ErPAWTKZ0DVSEw1MZasA53DQPmJ0xnYNGidPG2fEXqzp2VXstBO ig09/al9vY9NO3vSr7SvbH/GCWWTilCxHm1DYIQMwKqXJlk0/yCVaZPJXLTWzKwm2aw1 l3DT7VLg0A3idwyAutudEHqzDYEPNyJHGbLHDzYWAJHOLusxKX8QQjpGQPCrm1ERSGDr XcQ9EqpnixytebqlUhaBNh69C/3o6iOajVRQgRHpm/tw+46XaLs66ywlcOgKnVLYWLuD kgTw+WlNOnJI+SBWN2QDFgagw79EL+QZB7Vkvj96hGXMjedDWJyGtuRY/AZl0dsCZ3NE Bw9A== X-Gm-Message-State: ALoCoQk7PC7Ds7uvA8Q340LqrnJ927CNwzIL5KlVzhh9OvswaVanXD1LVQQ6XfpQxt1obGmeMC7T X-Received: by 10.194.109.35 with SMTP id hp3mr1481343wjb.55.1378390286583; Thu, 05 Sep 2013 07:11:26 -0700 (PDT) Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3]) by mx.google.com with ESMTPSA id fz8sm12053385wic.0.1969.12.31.16.00.00 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Thu, 05 Sep 2013 07:11:25 -0700 (PDT) From: Jani Nikula To: "Tomi.Ollila" , notmuch@notmuchmail.org Subject: Re: [PATCH 1/1] emacs: fix notmuch-mua-reply point placement when signature involved In-Reply-To: <1378322458-30159-1-git-send-email-tomi.ollila@iki.fi> References: <1378322458-30159-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Notmuch/0.15.2+177~gb1ba76c (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu) Date: Thu, 05 Sep 2013 16:11:19 +0200 Message-ID: <87d2one4u0.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: tomi.ollila@iki.fi 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:11:36 -0000 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. Cheers, Jani. [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." > > ;; 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)))) > > (let ((from (plist-get original-headers :From)) > (date (plist-get original-headers :Date)) > -- > 1.8.0 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch