From 3e8dd03fe47b30be411be3d0c2682ad01e7e75cc Mon Sep 17 00:00:00 2001 From: David Bremner Date: Thu, 22 Jan 2015 09:37:32 +0100 Subject: [PATCH] [PATCH] emacs: escape % in header line format --- 7d/4a91b1bfe3b2fa3059e3600188b51a6198817d | 81 +++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 7d/4a91b1bfe3b2fa3059e3600188b51a6198817d diff --git a/7d/4a91b1bfe3b2fa3059e3600188b51a6198817d b/7d/4a91b1bfe3b2fa3059e3600188b51a6198817d new file mode 100644 index 000000000..4571e879b --- /dev/null +++ b/7d/4a91b1bfe3b2fa3059e3600188b51a6198817d @@ -0,0 +1,81 @@ +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 236E8431FC9 + for ; Thu, 22 Jan 2015 00:39:34 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.438 +X-Spam-Level: ** +X-Spam-Status: No, score=2.438 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 66hHeuW44+18 for ; + Thu, 22 Jan 2015 00:39:31 -0800 (PST) +Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net + [87.98.215.224]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 5664C431FBC + for ; Thu, 22 Jan 2015 00:39:31 -0800 (PST) +Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim + 4.80) (envelope-from ) + id 1YEDGx-0006LM-VS; Thu, 22 Jan 2015 08:37:51 +0000 +Received: (nullmailer pid 14038 invoked by uid 1000); Thu, 22 Jan 2015 + 08:37:38 -0000 +From: David Bremner +To: Jinwoo Lee , David Bremner , + notmuch@notmuchmail.org +Subject: [PATCH] emacs: escape % in header line format +Date: Thu, 22 Jan 2015 09:37:32 +0100 +Message-Id: <1421915852-13963-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: +References: +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, 22 Jan 2015 08:39:34 -0000 + +We set header-line-format to the message subject, but if the subject +contains percents, the next character is interpreted as a formatting +control, which is not desired. +--- + +You're correct of course. I have no idea how my testing convinced me +the previous version worked. + +emacs/notmuch-show.el | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 9f6fe07..87b4881 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1198,7 +1198,11 @@ function is used." + (notmuch-show-mapc (lambda () (notmuch-show-set-prop :orig-tags (notmuch-show-get-tags)))) + + ;; Set the header line to the subject of the first message. +- (setq header-line-format (notmuch-sanitize (notmuch-show-strip-re (notmuch-show-get-subject)))) ++ (setq header-line-format ++ (replace-regexp-in-string "%" "%%" ++ (notmuch-sanitize ++ (notmuch-show-strip-re ++ (notmuch-show-get-subject))))) + + (run-hooks 'notmuch-show-hook)))) + +-- +2.1.4 + -- 2.26.2