From e5ec01ae005c74a02245478a55cfed58047f2860 Mon Sep 17 00:00:00 2001 From: "Tomi.Ollila" Date: Wed, 4 Sep 2013 22:20:58 +0300 Subject: [PATCH] [PATCH 1/1] emacs: fix notmuch-mua-reply point placement when signature involved --- ca/7b119723a55b58d3c63b372984c8a6f3eb96df | 90 +++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 ca/7b119723a55b58d3c63b372984c8a6f3eb96df diff --git a/ca/7b119723a55b58d3c63b372984c8a6f3eb96df b/ca/7b119723a55b58d3c63b372984c8a6f3eb96df new file mode 100644 index 000000000..02047216c --- /dev/null +++ b/ca/7b119723a55b58d3c63b372984c8a6f3eb96df @@ -0,0 +1,90 @@ +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 1DE00429E3C + for ; Wed, 4 Sep 2013 12:21:25 -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 ifBI5qN9ZnW1 for ; + Wed, 4 Sep 2013 12:21:17 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 082D8429E34 + for ; Wed, 4 Sep 2013 12:21:17 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 1BE1C100063; Wed, 4 Sep 2013 22:21:12 +0300 (EEST) +From: "Tomi.Ollila" +To: notmuch@notmuchmail.org +Subject: [PATCH 1/1] emacs: fix notmuch-mua-reply point placement when + signature involved +Date: Wed, 4 Sep 2013 22:20:58 +0300 +Message-Id: <1378322458-30159-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +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: Wed, 04 Sep 2013 19:21:25 -0000 + +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. +--- + 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 + -- 2.26.2