From 6bdcc9ab07a8df2667f7d588b3fc014b116807bd Mon Sep 17 00:00:00 2001 From: Jinwoo Lee Date: Fri, 23 Jan 2015 09:49:05 +1600 Subject: [PATCH] Re: [PATCH] emacs: escape % in header line format --- 05/1007b211d08412deed8c900e5a27c0cd229b9e | 104 ++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 05/1007b211d08412deed8c900e5a27c0cd229b9e diff --git a/05/1007b211d08412deed8c900e5a27c0cd229b9e b/05/1007b211d08412deed8c900e5a27c0cd229b9e new file mode 100644 index 000000000..f3ddda1dd --- /dev/null +++ b/05/1007b211d08412deed8c900e5a27c0cd229b9e @@ -0,0 +1,104 @@ +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 A4BB6431FC9 + for ; Thu, 22 Jan 2015 09:49:10 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.639 +X-Spam-Level: ** +X-Spam-Status: No, score=2.639 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + DNS_FROM_AHBL_RHSBL=2.438, FREEMAIL_ENVFROM_END_DIGIT=1, + FREEMAIL_FROM=0.001, 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 Ir-RFFwBDFfO for ; + Thu, 22 Jan 2015 09:49:07 -0800 (PST) +Received: from mail-ie0-f179.google.com (mail-ie0-f179.google.com + [209.85.223.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 7046A431FBC + for ; Thu, 22 Jan 2015 09:49:07 -0800 (PST) +Received: by mail-ie0-f179.google.com with SMTP id x19so2703048ier.10 + for ; Thu, 22 Jan 2015 09:49:06 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type; + bh=xchMqlwDL128EybK/4aOQyk48ZTlHrvAVqFDQQk3A54=; + b=kL88fXzPDcfIatw4YhgcmxVdr4+1+BE5jNWP9qgAJJJV/r78/jwi6SK8X2rUqzOpui + SsneU5wuNw/LhenOJthxO0J2mzZRg23Bo93o5qPabrdftCz2NDG3M7KOMS50jCGSnshH + RPluQ7WYBWd6Dk+GYB+pVGSsgJX0uLPaeYVSchn49OxEcY+OKBHzT3aE3D3Ja4NJwGnY + tOhXn4dFRlFBAbJMibLA9otf89krqWjRDVgNoBhMT7T79LdO18O+oVV2QLlpYng+DzV0 + 5NiOpG7iHxUMugoXuC/izRKdILGW+U62YzSFEsFh1JHS0j0r0bGvPjwA2YaIoFomAdxU + VF0A== +X-Received: by 10.42.145.5 with SMTP id d5mr4741183icv.8.1421948945950; + Thu, 22 Jan 2015 09:49:05 -0800 (PST) +Received: from localhost ([2620:0:1000:407c:9166:f28e:7341:7e7c]) + by mx.google.com with ESMTPSA id t1sm5651327igs.0.2015.01.22.09.49.04 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Thu, 22 Jan 2015 09:49:04 -0800 (PST) +From: Jinwoo Lee +To: David Bremner , David Bremner , + notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: escape % in header line format +In-Reply-To: <1421915852-13963-1-git-send-email-david@tethera.net> +References: + <1421915852-13963-1-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.4.1 + (x86_64-apple-darwin13.2.0) +Date: Thu, 22 Jan 2015 09:49:05 -0800 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain +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 17:49:10 -0000 + +Yup. It works! Thanks for the quick fix. Is this going to be merged +to HEAD soon? + +-jinwoo + +On Thu, Jan 22, 2015 at 12:37 AM, David Bremner wrote: +> 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