unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [PATCH v2] emacs: cl-letf enriched-decode-display-prop for text/encriched display
Date: Wed, 20 Sep 2017 08:25:44 +0300	[thread overview]
Message-ID: <20170920052544.2893-1-tomi.ollila@iki.fi> (raw)
In-Reply-To: <20170916091827.2012-1-tomi.ollila@iki.fi>

Dynamically bind enriched-decode-display-prop when inserting
text/enriched part. This complements commit 9b0582383833 for
emacs versions before 24.4 which do not have advice-add functionality.

Note the (require 'enriched). Without that if 'enriched were not
already provided, the part processing via mm-display-part would
eventually load that, providing enriched-decode-display-prop
overriding our temporary definition (for the first time
text/enriched part is handled).
---

I felt mentioning this (require 'enriched) important enough to be
stored in the blockchain of notmuch commit history -- knowing such
a subtle behaviour may prevent related bugs somewhere, sometime...

I've now tested this on Emacs 25.2.1 I also tried on Emacs 23.1.1
but there my environment gave:

$ EMACS=/usr/bin/emacs ./devel/try-emacs-mua -Q
+ exec /usr/bin/emacs --debug-init --load ./devel/try-emacs-mua -Q
Fatal error (6)zsh: abort      EMACS=/usr/bin/emacs ./devel/try-emacs-mua -Q

(not immediately, but when trying to see search output...)

anyway, now I've checked:

$ less emacs-25.2/lisp/textmodes/enriched.el
$ less emacs-24.3/lisp/textmodes/enriched.el
$ less emacs-23.1/lisp/textmodes/enriched.el

and the implementation is same enough to know that this works
similarly on all of these emacs versions...

For 0.26 it is time to explicitly drop support for emacs 23
and deprecate emacs versions before 24.4...

 emacs/notmuch-show.el | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 993902770095..1514eca57f43 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -773,14 +773,12 @@ (defun notmuch-show-insert-part-text/calendar (msg part content-type nth depth b
 (defun notmuch-show-insert-part-text/x-vcalendar (msg part content-type nth depth button)
   (notmuch-show-insert-part-text/calendar msg part content-type nth depth button))
 
-;; https://bugs.gnu.org/28350
-(defun notmuch-show--enriched-decode-display-prop (start end &optional param)
-  (list start end))
-
 (defun notmuch-show-insert-part-text/enriched (msg part content-type nth depth button)
-  (advice-add 'enriched-decode-display-prop :override
-	      #'notmuch-show--enriched-decode-display-prop)
-  nil)
+  ;; https://bugs.gnu.org/28350
+  (require 'enriched)
+  (cl-letf (((symbol-function 'enriched-decode-display-prop)
+	     (lambda (start end &optional param) (list start end))))
+    (notmuch-show-insert-part-*/* msg part content-type nth depth button)))
 
 (defun notmuch-show-get-mime-type-of-application/octet-stream (part)
   ;; If we can deduce a MIME type from the filename of the attachment,
-- 
2.13.3

  reply	other threads:[~2017-09-20  5:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-16  9:18 [RFC PATCH] emacs: cl-letf enriched-decode-display-prop for text/encriched display Tomi Ollila
2017-09-20  5:25 ` Tomi Ollila [this message]
2017-09-20  7:49   ` [PATCH v2] " David Edmondson
2017-09-20 11:12   ` David Bremner
2017-10-04 20:24   ` [PATCH v3] emacs: letf " Tomi Ollila
2017-11-08 19:34     ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170920052544.2893-1-tomi.ollila@iki.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).