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 6BE2940DEF8 for ; Wed, 17 Nov 2010 05:35:32 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham 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 gKTqf3mhqNXl for ; Wed, 17 Nov 2010 05:35:19 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) by olra.theworths.org (Postfix) with ESMTP id B85C140DEF5 for ; Wed, 17 Nov 2010 05:35:18 -0800 (PST) Received: by wwb18 with SMTP id 18so144449wwb.2 for ; Wed, 17 Nov 2010 05:35:14 -0800 (PST) Received: by 10.227.138.147 with SMTP id a19mr9337926wbu.225.1290000912431; Wed, 17 Nov 2010 05:35:12 -0800 (PST) Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com [81.149.164.25]) by mx.google.com with ESMTPS id x59sm1148377weq.38.2010.11.17.05.35.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 17 Nov 2010 05:35:11 -0800 (PST) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id AC678594058; Wed, 17 Nov 2010 13:32:34 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Remove over-eager regular expressions from notmuch-wash-tidy-citations. Date: Wed, 17 Nov 2010 13:32:33 +0000 Message-Id: <1290000753-20274-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <87eialdot9.fsf@yoom.home.cworth.org> References: <87eialdot9.fsf@yoom.home.cworth.org> 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, 17 Nov 2010 13:35:32 -0000 The removed expressions, which were used to ensure that citations were both preceded and followed by a blank line, were poorly implemented and caused a regexp stack overflow on messages more than a few thousand lines long. --- Carl, I was not able to find a version of the regular expressions that didn't easily overflow. For now, this patch removes the problematic expressions and I'll look for a better solution. emacs/notmuch-wash.el | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index cfcfb21..c4a7a41 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -190,7 +190,7 @@ is what to put on the button." (defun notmuch-wash-tidy-citations (depth) "Improve the display of cited regions of a message. -Perform four transformations on the message body: +Perform several transformations on the message body: - Remove lines of repeated citation leaders with no other content, @@ -214,17 +214,7 @@ Perform four transformations on the message body: ;; text. (goto-char (point-min)) (while (re-search-forward "\\(^>[> ]*\n\\)\\(^$\\|^[^>].*\\)" nil t) - (replace-match "\\2")) - - ;; Insert a blank line before a citation if there isn't one. - (goto-char (point-min)) - (while (re-search-forward "\\(^[^>]+\\)\n>" nil t) - (replace-match "\\1\n\n>")) - - ;; Insert a blank line after a citation if there isn't one. - (goto-char (point-min)) - (while (re-search-forward "\\(^>.+\\)\n\\([^>]\\)" nil t) - (replace-match "\\1\n\n\\2"))) + (replace-match "\\2"))) ;; -- 1.7.2.3