emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Fontification for the inner bloc of two nested bloc
@ 2017-10-01 14:36 Pierre-Andre Cornillon
  0 siblings, 0 replies; 6+ messages in thread
From: Pierre-Andre Cornillon @ 2017-10-01 14:36 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I have a question about fontification of inner src bloc.

I have two nested blocks: one special (outer bloc) and one src (inner
bloc) like this
#+begin_bloc20171001122500 
#+begin_src R :results value :session :exports both
  blip <- runif(2)
  test <- rnorm(2)
#+end_src
#+end_bloc20171001122500
and I want to have the native fontification property for the inner one.

I have already (setq org-src-fontify-natively t) in my .emacs and it
works like a charm for src blocks alone (not nested) but for nested
ones it breaks.

Is nested blocks are allowed and if so, is that possible to have that
fontification property ?

Thanks,
Pierre-Andre

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

* Fontification for the inner bloc of two nested bloc
@ 2017-10-05  9:59 Pierre-André Cornillon
  0 siblings, 0 replies; 6+ messages in thread
From: Pierre-André Cornillon @ 2017-10-05  9:59 UTC (permalink / raw)
  To: emacs-orgmode

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

Dear org-mode users/gurus


I have a question about fontification of inner src bloc. I have already
submitted this question to the list a few days ago but it did not appear
(and I suspect my mail account to be blacklisted) So I apologize first if
this question is submitted another time to the list...

I have two nested blocks: one special (outer bloc) and one src (inner
bloc) like this
#+begin_bloc20171001122500
#+begin_src R :results value :session :exports both
  blip <- runif(2)
  test <- rnorm(2)
#+end_src
#+end_bloc20171001122500
and I want to have the native fontification property for the inner one.

I have already (setq org-src-fontify-natively t) in my .emacs and it
works like a charm for src blocks alone (not nested) but for nested
ones it breaks.

Is nested blocks are allowed and if so, is that possible to have that
fontification property ?

Thanks,
Pierre-Andre

[-- Attachment #2: Type: text/html, Size: 1000 bytes --]

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

* Fontification for the inner bloc of two nested bloc
@ 2017-10-07  9:11 Pierre-André Cornillon
  2017-10-10  7:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre-André Cornillon @ 2017-10-07  9:11 UTC (permalink / raw)
  To: emacs-orgmode

Dear orgmode users/gurus,

I have a question about fontification of inner src bloc.

I have two nested blocks: one special (outer bloc) and one src (inner
bloc) like this

#+begin_bloc20171001122500
#+begin_src R
  blip <- runif(2)
  test <- rnorm(2)
#+end_src
#+end_bloc20171001122500

and I want to have the native fontification property for the inner one.

I have already (setq org-src-fontify-natively t) in my .emacs and it
works like a charm for src blocks alone (not nested) but for nested
ones it breaks.

Is nested blocks are allowed and if so, is that possible to have that
fontification property ?

Best regards,
Pierre-Andre

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

* Re: Fontification for the inner bloc of two nested bloc
  2017-10-07  9:11 Pierre-André Cornillon
@ 2017-10-10  7:16 ` Nicolas Goaziou
  2017-10-11 15:54   ` Pierre-André Cornillon
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2017-10-10  7:16 UTC (permalink / raw)
  To: Pierre-André Cornillon; +Cc: emacs-orgmode

Hello,

Pierre-André Cornillon <pac.herault@gmail.com> writes:

> Dear orgmode users/gurus,
>
> I have a question about fontification of inner src bloc.
>
> I have two nested blocks: one special (outer bloc) and one src (inner
> bloc) like this
>
> #+begin_bloc20171001122500
> #+begin_src R
>   blip <- runif(2)
>   test <- rnorm(2)
> #+end_src
>
> #+end_bloc20171001122500
>
> and I want to have the native fontification property for the inner one.
>
> I have already (setq org-src-fontify-natively t) in my .emacs and it
> works like a charm for src blocks alone (not nested) but for nested
> ones it breaks.
>
> Is nested blocks are allowed and if so, is that possible to have that
> fontification property ?

Nested blocks are allowed, but the fontification system has a few
shortcomings, including this one. Ultimately, this part of Org needs to
be rewritten using the parser.

Anyway The bug probably lies in `org-fontify-meta-lines-and-blocks-1'.
Do you want to investigate?

Regards,

-- 
Nicolas Goaziou

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

* Re: Fontification for the inner bloc of two nested bloc
  2017-10-10  7:16 ` Nicolas Goaziou
@ 2017-10-11 15:54   ` Pierre-André Cornillon
  2017-10-11 16:00     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre-André Cornillon @ 2017-10-11 15:54 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

Hello,

On Tue, Oct 10, 2017 at 9:16 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Pierre-André Cornillon <pac.herault@gmail.com> writes:
>
>> Dear orgmode users/gurus,
>>
>> I have a question about fontification of inner src bloc.
>>
>> I have two nested blocks: one special (outer bloc) and one src (inner
>> bloc) like this
>>
>> #+begin_bloc20171001122500
>> #+begin_src R
>>   blip <- runif(2)
>>   test <- rnorm(2)
>> #+end_src
>>
>> #+end_bloc20171001122500
>>
>> and I want to have the native fontification property for the inner one.
>>
>> I have already (setq org-src-fontify-natively t) in my .emacs and it
>> works like a charm for src blocks alone (not nested) but for nested
>> ones it breaks.
>>
>> Is nested blocks are allowed and if so, is that possible to have that
>> fontification property ?
>
> Nested blocks are allowed, but the fontification system has a few
> shortcomings, including this one. Ultimately, this part of Org needs to
> be rewritten using the parser.
what is "the parser" exactly ?
>
> Anyway The bug probably lies in `org-fontify-meta-lines-and-blocks-1'.
> Do you want to investigate?

I agree that the regular search expression in the
org-fontify-meta-lines-and-blocks-1 seems to match only one level of
src block. I am not an elisp programmer but splitting
the function in two part will allow to make it recursive (and thus to
cope with several level of nested src block) ? Well it's pure
speculation without testing...

>
> Regards,
>
> --
> Nicolas Goaziou

Best regards,
Pierre-Andre

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

* Re: Fontification for the inner bloc of two nested bloc
  2017-10-11 15:54   ` Pierre-André Cornillon
@ 2017-10-11 16:00     ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2017-10-11 16:00 UTC (permalink / raw)
  To: Pierre-André Cornillon; +Cc: Org Mode List

Hello,

Pierre-André Cornillon <pac.herault@gmail.com> writes:

> what is "the parser" exactly ?

It is "org-element.el".

>> Anyway The bug probably lies in `org-fontify-meta-lines-and-blocks-1'.
>> Do you want to investigate?
>
> I agree that the regular search expression in the
> org-fontify-meta-lines-and-blocks-1 seems to match only one level of
> src block. I am not an elisp programmer but splitting
> the function in two part will allow to make it recursive (and thus to
> cope with several level of nested src block) ? Well it's pure
> speculation without testing...

It probably would. But then, there is `font-lock-multiline', which
prevents further fontification.

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

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

end of thread, other threads:[~2017-10-11 16:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-01 14:36 Fontification for the inner bloc of two nested bloc Pierre-Andre Cornillon
  -- strict thread matches above, loose matches on Subject: below --
2017-10-05  9:59 Pierre-André Cornillon
2017-10-07  9:11 Pierre-André Cornillon
2017-10-10  7:16 ` Nicolas Goaziou
2017-10-11 15:54   ` Pierre-André Cornillon
2017-10-11 16:00     ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).