help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rendering buffer to HTML from command line script


From: Stéphane Travostino
Subject: Rendering buffer to HTML from command line script
Date: Sat, 20 Feb 2016 17:20:29 +0000

Hello,

I'm trying to create a command line Emacs script that, by specifying a file
and a theme, renders the file to HTML using the theme colours.
For example:

emacs --script render-theme.el some-theme.el test.c > test.c.html

I'm using htmlfontify to render the buffer to HTML, and works great when
called from X, but I get a black and white output when called from the
terminal _with most themes_.

The problem is that themes specify the minimum terminal requirements to
enable a specific face, i.e. minimum amount of colours supported by the
terminal, window-system, etc. (
http://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Faces.html
)

For example: (defface 'foo (((min-colors 88) (class color) etc.))

If I modify the theme to disable these terminal requirements options,
htmlfontify renders correctly.

That's probably a long shot, but is it possible to either force a
particular terminal configuration from command line, or force-enable all
theme faces?

For example, (display-color-cells) in X returns 16777216, while I get 0
when executed from the script; that's probably part of the problem.

Why am I doing this: I want to create an Emacs theme browser web
application which creates a preview of any theme against a few different
file formats, and I want an headless Emacs to create the HTML preview.

Thanks.
Stephane.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]