Gnus development mailing list
 help / color / mirror / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: ding@gnus.org
Subject: Re: Org src-blocks not shown correctly
Date: Fri, 22 Aug 2014 11:20:18 +0200	[thread overview]
Message-ID: <87lhqg7uel.fsf@gmail.com> (raw)
In-Reply-To: <87bnrd6jhw.fsf@ucl.ac.uk>

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Thursday, 21 Aug 2014 at 21:09, Thorsten Jolitz wrote:
>
> [...]
>
>> hmm ... I don't even know "who" is rendering/fontifying these blocks in
>> article mode. I'm not really up-to-date with gnus, but fairly up-to-date
>> with Org - is Org at all involved here?
>
> Good questions.  I know that I used to have, a very long time ago now,
> my own customisations for viewing org snippets with fontification but
> there is no sign of any such customisations in my files any
> longer.  Gnus itself must be taking care of it.  So, from the git log of
> gnus: 
>
> ,----
> | commit 3313cd8482c0ac34077ae1ca4721bb6af8b0e0b6
> | Author: Lars Ingebrigtsen <larsi@gnus.org>
> | Date:   Sat Jan 28 20:33:23 2012 +0100
> | 
> |     Make fontification of org modes work again
> |     
> |     * mm-view.el (mm-display-inline-fontify): Bind
> | font-lock-support-mode'
> |     instead of setting it locally, since the latter doesn't seem to have
> |     any effect (most of the time).
> `----
>
> Maybe have a look at mm-view.el, specifically mm-display-inline-fontify?

Yes, this is the function doing the job:

,----[ C-h f mm-display-inline-fontify RET ]
| mm-display-inline-fontify is a Lisp function in `mm-view.el'.
| 
| (mm-display-inline-fontify HANDLE &optional MODE)
| 
| Insert HANDLE inline fontifying with MODE.
| If MODE is not set, try to find mode automatically.
`----

It looks alright to me, the only problem is that 'handle, i.e. the
org-element src-block in this case, lacks a trailing linefeed:

,----
| Result: "#+BEGIN_SRC emacs-lisp\n  (- 2 2)\n#+END_SRC\n"
`----

now we need only to find out the place where 'handle' is parsed (I could
not find it in mm-view.el in reasonable time) then we would see the
cause of the problem. 

If this uses the new parser, this is parsed:

,----[ C-h f org-element-src-block-parser RET ]
| org-element-src-block-parser is a compiled Lisp function in
| `org-element.el'.
| [...]
| Return a list whose CAR is `src-block' and CDR is a plist
| containing `:language', `:switches', `:parameters', `:begin',
| `:end', `:number-lines', `:retain-labels', `:use-labels',
| `:label-fmt', `:preserve-indent', `:value', `:post-blank' and
| `:post-affiliated' keywords.
`----

but the interpreter

,----[ C-h f org-element-src-block-interpreter RET ]
| org-element-src-block-interpreter is a compiled Lisp function in
| `org-element.el'.
| 
| (org-element-src-block-interpreter SRC-BLOCK CONTENTS)
| 
| Interpret SRC-BLOCK element as Org syntax.
| CONTENTS is nil.
`----

uses only these properties, thus the :post-blank's are lost. 

,----
| (:language :switches :parameters :value :preserve-indent)
`----

Otherwise, with old-school regexp-matching, the trailing blank
line isn't part of the match either.

-- 
cheers,
Thorsten




  parent reply	other threads:[~2014-08-22  9:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87r40a9j0k.fsf@gmail.com>
2014-08-21 13:00 ` Eric S Fraga
2014-08-21 13:59   ` Jorge A. Alfaro-Murillo
2014-08-21 18:20   ` Thorsten Jolitz
2014-08-21 18:51     ` Eric S Fraga
2014-08-21 19:09       ` Thorsten Jolitz
2014-08-22  8:01         ` Eric S Fraga
2014-08-22  8:24           ` Eric Abrahamsen
2014-08-22  8:49             ` Thorsten Jolitz
2014-08-22 10:45             ` Eric S Fraga
2014-08-22  9:20           ` Thorsten Jolitz [this message]
2014-08-22 10:01           ` Katsumi Yamaoka

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

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

  git send-email \
    --in-reply-to=87lhqg7uel.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=ding@gnus.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.
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).