Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Fontification of an org-mode source block in PGP signed message does not work
@ 2011-07-28 17:44 Daniel Dehennin
  2011-07-29  8:48 ` Julien Danjou
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Dehennin @ 2011-07-28 17:44 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 2214 bytes --]

You can merge my changes from the dad/master branch of my repository[1].

As an exemple, here is an org-mode source block which should not work
for unpatched 'mm-dissect-buffer':

#+begin_src emacs-lisp
;; This is not fontified for unpatched sources.
(setq foo "bar")
#+end_src

Regards.

Signed messages are passed thought 'mm-uu-dissect-text-parts' and
unsigned one thought 'mm-uu-dissect'.

'gnus-display-mime' do the job:

- when no MIME header and 'gnus-article-emulate-mime' is t, it process
  mail to find emulated parts like #+begin_/#+end_ for org-mode source
  blocks,

- when a MIME header is present, each part is processed using
  'mm-uu-dissect-text-parts'.

'mm-uu-dissect-text-parts' should process each part with 'mm-uu-dissect'
but does not in that case.

The problem is located in 'mm-dissect-buffer' which does not define the
content-disposition if none is present in the MIME header.

* lisp/mm-decode.el (mm-dissect-buffer): Set undefined
  content-disposition to "inline" if the part is text based.
---
 lisp/mm-decode.el |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

#+begin_src diff
diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el
index a51c663..760d2d0 100644
--- a/lisp/mm-decode.el
+++ b/lisp/mm-decode.el
@@ -564,7 +564,14 @@ Postpone undisplaying of viewers for types in
 	  (setq ct (mail-fetch-field "content-type")
 		ctl (and ct (mail-header-parse-content-type ct))
 		cte (mail-fetch-field "content-transfer-encoding")
-		cd (mail-fetch-field "content-disposition")
+		cd (or (mail-fetch-field "content-disposition")
+		       (if (and (not (null ctl))
+			    (string-match "mm-inline-text"
+					  (symbol-name
+					   (cadr (mm-assoc-string-match
+						  mm-inline-media-tests
+						  (car ctl))))))
+			    "inline"))
 		;; Newlines in description should be stripped so as
 		;; not to break the MIME tag into two or more lines.
 		description (message-fetch-field "content-description")
-- 
1.7.5.4
#+end_src

Footnotes: 
[1]  http://www.baby-gnu.org/~nebu/archives/gnus/gnus.git/

-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fontification of an org-mode source block in PGP signed message does not work
  2011-07-28 17:44 [PATCH] Fontification of an org-mode source block in PGP signed message does not work Daniel Dehennin
@ 2011-07-29  8:48 ` Julien Danjou
  2011-07-29  9:43   ` Daniel Dehennin
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Danjou @ 2011-07-29  8:48 UTC (permalink / raw)
  To: Daniel Dehennin; +Cc: ding

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

On Thu, Jul 28 2011, Daniel Dehennin wrote:

> The problem is located in 'mm-dissect-buffer' which does not define the
> content-disposition if none is present in the MIME header.

Good one.

I've simplified it a bit, I hope I did not break it. At least it seems
to work for me. :)

Thanks Daniel.
-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fontification of an org-mode source block in PGP signed message does not work
  2011-07-29  8:48 ` Julien Danjou
@ 2011-07-29  9:43   ` Daniel Dehennin
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Dehennin @ 2011-07-29  9:43 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

Julien Danjou <julien@danjou.info> writes:

> On Thu, Jul 28 2011, Daniel Dehennin wrote:
>
>> The problem is located in 'mm-dissect-buffer' which does not define the
>> content-disposition if none is present in the MIME header.
>
> Good one.
>
> I've simplified it a bit, I hope I did not break it. At least it seems
> to work for me. :)

It works, I switched to string-match to parse other mm-inline-text-*
without Content-Disposition header, I found only two others:

- mm-inline-text-html
- mm-inline-text-vcard

So, just mm-inline-text is sufficient.

Thanks.
-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-29  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-28 17:44 [PATCH] Fontification of an org-mode source block in PGP signed message does not work Daniel Dehennin
2011-07-29  8:48 ` Julien Danjou
2011-07-29  9:43   ` Daniel Dehennin

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 NNTP newsgroup(s).