From ee46eda79ec76fef67e82061c21fae10a8610a9e Mon Sep 17 00:00:00 2001 From: Jinwoo Lee Date: Fri, 23 Jan 2015 00:15:50 +1600 Subject: [PATCH] Re: [PATCH] emacs: escape % in header line format --- 40/b83f189de43c00b280ad83c48179c0bcef29d3 | 105 ++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 40/b83f189de43c00b280ad83c48179c0bcef29d3 diff --git a/40/b83f189de43c00b280ad83c48179c0bcef29d3 b/40/b83f189de43c00b280ad83c48179c0bcef29d3 new file mode 100644 index 000000000..7bcfccde1 --- /dev/null +++ b/40/b83f189de43c00b280ad83c48179c0bcef29d3 @@ -0,0 +1,105 @@ +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 A45A5431FCB + for ; Thu, 22 Jan 2015 00:15:58 -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 MHT7N3Nley+V for ; + Thu, 22 Jan 2015 00:15:55 -0800 (PST) +Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com + [209.85.192.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 099E6431FC9 + for ; Thu, 22 Jan 2015 00:15:55 -0800 (PST) +Received: by mail-pd0-f179.google.com with SMTP id v10so263508pde.10 + for ; Thu, 22 Jan 2015 00:15:54 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:in-reply-to:references:user-agent:date + :message-id:mime-version:content-type; + bh=jJoUI1Vyhg7RmXJtDHD8xX3oC9Kn2RIcREYeDnHfwus=; + b=JW9+hfnYcQ+K8XcPtsk5ux/FjamtoqYM6svxbxfWdUZyQXDAHAbRdX/BjNs+bWWf4S + 0a16zn4b2OsgysFeeKkjXnsRijr6QLZTCJPrk+AFs2Naqfyc5eCx4AQ1L2NH9cnoWkM/ + p3m6JcXmTv8MHy/3btxPDoMApYsqfesK/xav8YLg50NsfDqE+9e0UhooXotHtA9Watgw + 5X++yUTQYBPCPbu58WXS4DD760LVkGzUoE7CRCS6hZNr/C5vn+xpoo+OBQ9IWvKzmDfT + UqMy/Le5Mup1wydbAEhLWkkv5p6Bdpp5JtKrLN2HgDB8E/2MTE56ru67RiwAJrMFAOHC + 2eZQ== +X-Received: by 10.66.124.225 with SMTP id ml1mr202862pab.142.1421914554022; + Thu, 22 Jan 2015 00:15:54 -0800 (PST) +Received: from localhost ([2601:9:5d00:15b9:9cc3:d58e:e3d6:9990]) + by mx.google.com with ESMTPSA id nb1sm5149737pdb.85.2015.01.22.00.15.52 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Thu, 22 Jan 2015 00:15:52 -0800 (PST) +From: Jinwoo Lee +To: David Bremner , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: escape % in header line format +In-Reply-To: <1421911089-31509-1-git-send-email-david@tethera.net> +References: + <1421911089-31509-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 00:15:50 -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 08:15:58 -0000 + +Thanks, David. But I don't think it's the correct fix. REPLACE-STRING +seems to replace a string in a buffer, not a string given as a param. +And it's for interactive use only. + +-jinwoo + +On Wed, Jan 21, 2015 at 11:18 PM, 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. +> --- +> +> Ironically you have to apply this patch to read it's subject properly +> ;). There is whitespace change here because the original line was way +> too long. +> +> 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..4258d43 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-string "%" "%%" +> + (notmuch-sanitize +> + (notmuch-show-strip-re +> + (notmuch-show-get-subject))))) +> +> (run-hooks 'notmuch-show-hook)))) +> +> -- +> 2.1.4 -- 2.26.2