[Top][All Lists]

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

Re: What happens with text properties in batch mode?

From: address@hidden
Subject: Re: What happens with text properties in batch mode?
Date: Sat, 8 Dec 2018 10:31:36 -0800 (PST)
User-agent: G2/1.0

On Friday, 7 December 2018 08:58:38 UTC+1, Marcin Borkowski  wrote:

> it seems that when I `princ' something with text properties (e.g.,
> colored faces) in batch mode, the colors disappear.  Is it documented
> anywhere?  Can I disable this behavior?

Can you tell me what you are trying to accomplish? Simply printing a 
highlighted text stdout and expecting it to be shown with colors doesn't work.

> I found this:, and its existence
> suggests that outputting colored stuff (using ANSI codes) is
> non-trivial.  Am I right?

It is non-trivial, I can assure you, I spent many months writing it.

One problem is that even though strings have face properties in batch mode, the 
faces themselves often fail to specify anything useful in batch mode. e2ansi 
contains a system for playing the "what if" game by allowing you to query 
things like "what would face X look like when in a gui with 16 millions colors, 
or in a black-and-white tty". (This part is placed in a stand alone library 
"face-explorer", along with tons of useful tools.)

The second problem is to translate the face information to ANSI. Note that 
Emacs internal system for rendering things in terminal mode is not available to 
elisp, so I had to implement everything from scratch.

Fortunately, you can use e2ansi as a library in your own packages. For example 
`e2ansi-string-to-ansi' converts a string with face information to ANSI. See 
`face-explorer-number-of-colors' and friends to control which features of ANSI 
will be used. (They have sane defaults, though.)

    -- Anders Lindgren

reply via email to

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