From: "andlind@gmail.com" <andlind@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: What happens with text properties in batch mode?
Date: Sat, 8 Dec 2018 10:31:36 -0800 (PST) [thread overview]
Message-ID: <aef278e7-94ff-40f0-8387-f2952a348a15@googlegroups.com> (raw)
In-Reply-To: <mailman.5310.1544169515.1284.help-gnu-emacs@gnu.org>
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: https://github.com/Lindydancer/e2ansi, 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
next parent reply other threads:[~2018-12-08 18:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5310.1544169515.1284.help-gnu-emacs@gnu.org>
2018-12-08 18:31 ` andlind [this message]
2018-12-08 20:08 ` What happens with text properties in batch mode? Marcin Borkowski
2018-12-07 7:56 Marcin Borkowski
2018-12-07 8:42 ` tomas
2018-12-08 19:28 ` Marcin Borkowski
2018-12-08 22:02 ` tomas
2018-12-07 9:05 ` Eli Zaretskii
2018-12-08 19:29 ` Marcin Borkowski
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aef278e7-94ff-40f0-8387-f2952a348a15@googlegroups.com \
--to=andlind@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.