emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bruno Barbier <brubar.cs@gmail.com>
To: Rudi C <rudiwillalwaysloveyou@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-mode: example blocks are no longer syntax highlighted in emacs
Date: Fri, 23 Feb 2024 11:35:05 +0100	[thread overview]
Message-ID: <65d874db.5d0a0220.e15b3.6301@mx.google.com> (raw)
In-Reply-To: <CAE9z9A0z6G_Sr2x8SEaCqSXzf8Yqx9YR9kYqKwvBN4=Z_L3hJQ@mail.gmail.com>


Hi Rudy,

Note that I am not an org maintainer; just trying to help :-)

Rudi C <rudiwillalwaysloveyou@gmail.com> writes:

>> Why is `:eval never` not as good ?  You don't have to write it on each
>> code block; you may set it globally, per file, per headline, etc.
>
> The main reason is that I also use source blocks for babel blocks that are
> runnable. So I cannot use per headline etc. solutions. I can use snippets
> to automatically insert `:eval never`, but it's not as good a UX.

You could customize `org-insert-structure-template' like this:

    (add-to-list 'org-structure-template-alist
                  (cons "p"  "src python :eval never"))

Then:

    C-c C-, p
    
should insert your code example:

   #+begin_src python :eval never
   #+end_src


> I also already have lots of org-mode notes written using `example lang`
> blocks. Rewriting all of these will be a PITA.

You could teach Emacs to fix/rewrite those for you.  Ask here if you
need help.  You're probably not the only one that will need to fix
them.


> NickD has identified the commit that introduced this breaking change:
>
> ...
> https://github.com/bzg/org-mode/commit/616e80a9f10c4bd085d7b5ac96fd6ea23e9c9191
> I wrote this patch which can be put in one's config to make this behavior
> configurable.

Thanks for the link.

(your code layout was broken, it's more reliable to attach these kinds
of documents)


> Can you merge this upstream? emacs is all about user customizability, and
> in general, breaking backward compatibility without giving a way out is bad.

According to the email thread, the change was made only to match the
documentation (see
https://list.orgmode.org/87zg7lghzz.fsf@gmail.com/).

So, maybe a new option, like you suggested will be accepted, something like:

   (defvar org-fontify-block-types '("src")
      "Which block types to fontify.
      Prior versions of Org may fontify other blocks than src.  That
      invalid behavior is now fixed.  If you have documents relying on
      this invalid behavior, and, you cannot fix them, add the block
      types to this list.")
      
But:
   -  Fontification must be fast. The more options, the harder to
      optimize.

   -  It might just be opening a can of worms: Why is editing not
      working too then ? Why is the indentation incorrect? Why are
      they not exported correctly ? Why is pandoc not able to handle
      them correctly ?  etc.

Let see what other people think.

Bruno



  reply	other threads:[~2024-02-23 10:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 15:47 org-mode: example blocks are no longer syntax highlighted in emacs Bruno Barbier
2024-02-22 20:08 ` Rudi C
2024-02-23 10:35   ` Bruno Barbier [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-22 15:02 Rudi C
2024-02-25 10:04 ` Ihor Radchenko
2024-02-26  0:39   ` Rudi C
2024-02-26 11:05   ` Max Nikulin
2024-02-28 12:13     ` Ihor Radchenko

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=65d874db.5d0a0220.e15b3.6301@mx.google.com \
    --to=brubar.cs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rudiwillalwaysloveyou@gmail.com \
    /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://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).