emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "M. Pger" <mpger@protonmail.com>
To: "M. Pger" <mpger@protonmail.com>
Cc: Tim Cross <theophilusx@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: no syntax highlighting for code blocks with org-publish
Date: Wed, 20 Jul 2022 05:22:44 +0000	[thread overview]
Message-ID: <YmBR481ZMgZpA6svOfEMt3nYa8UPEKgvFUY5s8SpRWu2YdJz0pb0gPz8ajcTeKFbF7SD1fD9XibICa8Z-JdTiIqgjOlD1y4yg9uHCB176ZA=@protonmail.com> (raw)
In-Reply-To: <vZh_aXsUhlwNcRMF3miS6hNUo6xxUCFuzm4dwfCNQHcm4Ib53t8sJVVJ-PmYD4sRfoCvWRjtEG7L5rfN4pRe5nDxLFWxWEG8ZqcZ5YvJyDs=@protonmail.com>

Actually, using -nw implies that no theme is loaded, so the face colors 'extracted' by htmlize are the flashy default colors of Emacs in terminal.

To have the colors associated with the theme I use, I had to load the theme through build.el and to change my bash script to:

emacs -q --load=build.el --eval="(eval-buffer)" --eval="(save-buffers-kill-terminal)"

The advantage is of course to have the desired face colors; the minor disadvantage is to see an Emacs frame appearing, loading the theme and then disappearing.



------- Original Message -------
On Wednesday, July 20th, 2022 at 1:14 AM, M. Pger <mpger@protonmail.com> wrote:

> I solved the issue by creating the following bash script in my project folder:
> #!/bin/sh
> TERM=xterm export TERM
> emacs -q -nw --load=build.el --eval="(eval-buffer)" --eval="(save-buffers-kill-terminal)"
> This avoid using --script (and thus batch) and thus allows font-lock to be enabled when my publishing elisp script (build.el) is run. Thanks to `TERM=xterm export TERM`, this bash script can be run from the Emacs shell (otherwise problematic because of the -nw option).
> To have 'extended' syntax highlighting for R, note that I have to load ESS from build.el.
> Hope this will help! Thanks again for your feedback and your insights.
> Best,
> M
> ------- Original Message -------
> On Wednesday, July 20th, 2022 at 12:33 AM, Tim Cross theophilusx@gmail.com wrote:
> > "M. Pger" mpger@protonmail.com writes:
> >
> > > I tried to publish using `M-x org-publish RET <name_of_project> RET` as you suggested, and
> > > syntax highlighting was actually implemented, thanks.
> > >
> > > Actually the problem is coming from the fact that I use `emacs -Q --script build.el` (as a
> > > bash script) to publish the project. According to
> > > https://list.orgmode.org/AE5693F1-F63D-4383-8840-0FD2DBAAC5D6@gmail.com/ (rather old, but
> > > apparently this has not changed), font-lock-mode is not enabled by default in --batch
> > > mode. Since `--script` "run Emacs in batch mode, like ‘--batch’, and then read and execute
> > > the Lisp code in file" (cf the doc), it seems that this is exactly my problem.
> > >
> > > A workaround is suggested in
> > > https://list.orgmode.org/AE5693F1-F63D-4383-8840-0FD2DBAAC5D6@gmail.com/, but
> > > unfortunately for me it does not work (yet). I am going to dig further into that.
> >
> > I would be interested to hear how you go. I have a use case coming up
> > where I need to publish a large number of org files using a batch job,
> > so expect to run into the same issue. Right now, I'm still getting my
> > head around how to best get a consistent style when the input comes from
> > multiple org files from different sources and I want to minimise editing
> > the sources, plus provide a simple way to update/change the styling
> > later.

  reply	other threads:[~2022-07-20  5:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 17:24 no syntax highlighting for code blocks with org-publish M. Pger
2022-07-17 23:42 ` Ihor Radchenko
2022-07-18  8:57   ` M. Pger
2022-07-18 21:50     ` Tim Cross
2022-07-18 22:55       ` M. Pger
2022-07-19  7:51         ` Tim Cross
2022-07-19 15:34           ` M. Pger
2022-07-19 22:33             ` Tim Cross
2022-07-19 23:14               ` M. Pger
2022-07-20  5:22                 ` M. Pger [this message]
2022-07-21 11:38                   ` 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:

  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='YmBR481ZMgZpA6svOfEMt3nYa8UPEKgvFUY5s8SpRWu2YdJz0pb0gPz8ajcTeKFbF7SD1fD9XibICa8Z-JdTiIqgjOlD1y4yg9uHCB176ZA=@protonmail.com' \
    --to=mpger@protonmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=theophilusx@gmail.com \


* 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


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).