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 D4E42431FC9 for ; Fri, 31 Oct 2014 03:16:33 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7, UNPARSEABLE_RELAY=0.001] 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 LdHam4X-T8Kb for ; Fri, 31 Oct 2014 03:16:28 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 3203B431FC2 for ; Fri, 31 Oct 2014 03:16:28 -0700 (PDT) Received: by mail-wi0-f176.google.com with SMTP id h11so871655wiw.3 for ; Fri, 31 Oct 2014 03:16: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:user-agent:from:to:subject:date:message-id; bh=IeMMGfAEx+kjLf/ZcUVAPv+aUJynreLzANWPVX3qwpE=; b=YqGAWj3NvdBoVA9g8Fn4gBQ8gRIkRyOv+tnBKEGDS56rN4apCh2Sx+5+3GyEFPpQzV cDbyVfIQ+EPDjXfoYMTwuRG8Hzgdebxy8Rei/kjGHPBYgVQ7Vz/itg0JqbU85RIH7DtF tLkRaS9lpJ/bmeIYdv6DxM4viLYp7w5JDRE5H+NrtlYzhy9x8buRhCsy/eHntsv/mevw dMM5TqZSGsqIbgJaxIhV6gCGjNaVy2OjSW6xtpWGBJjTc9a4N2XzoE99ZahiuOubyyLK RkIo7/khB6HNf7H3EeLFDhO+dvq1tV2APCOzJC72O+wr9/nqVKLY3bLR8/WKJLvN7NGG cbRQ== X-Gm-Message-State: ALoCoQk+R6dMYoGNjXXwHgHuwaCPx+L8RhfRMvxA8hSSnrOhOV9jhOb2KzTCHt3wvYtsoT/LV38g X-Received: by 10.194.3.78 with SMTP id a14mr1939353wja.107.1414750586690; Fri, 31 Oct 2014 03:16:26 -0700 (PDT) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [81.149.164.25]) by mx.google.com with ESMTPSA id j20sm11572643wjn.0.2014.10.31.03.16.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Oct 2014 03:16:25 -0700 (PDT) Received: from localhost (30000@localhost [local]); by localhost (OpenSMTPD) with ESMTPA id 11a6aee0; for ; Fri, 31 Oct 2014 10:16:07 +0000 (UTC) User-Agent: OpenSMTPD enqueuer (Demoostik) From: David Edmondson To: notmuch@notmuchmail.org Subject: [RFC] [PATCH v1] emacs: More citation washing. Date: Fri, 31 Oct 2014 10:16:07 +0000 Message-Id: <1414750567-25077-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.9.3 (Apple Git-50) 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: Fri, 31 Oct 2014 10:16:34 -0000 Ensure that a citation is preceded and followed by a blank line, unless the preceding line looks like a citation leader. --- Washing changes are always a bit risky, as they are heuristic based. Testers for this (alleged) improvement welcome! emacs/notmuch-wash.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index 8fe91e1..83621bb 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -276,7 +276,19 @@ Perform several transformations on the message body: ;; text. (goto-char (point-min)) (while (re-search-forward "\\(^>[> ]*\n\\)\\(^$\\|^[^>].*\\)" nil t) - (replace-match "\\2"))) + (replace-match "\\2")) + + ;; Ensure that a citation block has a blank line before it, unless + ;; the previous line ends in ':' (because that's probably the + ;; citation). + (goto-char (point-min)) + (while (re-search-forward "^[^>].*[^:]\\(\n\\)>.*" nil t) + (replace-match "\n\n" nil nil nil 1)) + + ;; Ensure that a citation block has a blank line after it. + (goto-char (point-min)) + (while (re-search-forward "^>.*\\(\n\\)[^>].*" nil t) + (replace-match "\n\n" nil nil nil 1))) ;; -- 1.9.3 (Apple Git-50)