unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Working with colors in --batch mode
Date: Sun, 25 Dec 2022 19:49:19 +0100	[thread overview]
Message-ID: <877cyfiaj4.fsf@gmail.com> (raw)
In-Reply-To: <83o7rr2vjk.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 25 Dec 2022 20:22:07 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sun, 25 Dec 2022 20:05:59 +0200
>> From: Eli Zaretskii <eliz@gnu.org>
>> 
>> Emacs doesn't (and cannot, I think) load X colors unless it
>> initializes the X display, and that doesn't happen in batch sessions.
>> Basically, batch sessions behave like a colorless TTY session.
>
> Btw, I don't really understand why you need the X machinery for this.
> Doesn't tty-color-standard-values do the job?
>
>  $ emacs -batch --eval "(message \"%s\" (tty-color-standard-values \"#abcdef\"))"
>   => (43947 52685 61423)

Because this message is the latest step in a longer journey that started
with me trying to call modus-themes-contrast in batch mode, as hinted in
the OP.

So I hope to find a solution that will let me keep calling this
high-level function, instead of re-implementing it and its callees
(e.g. color-name-to-rgb).

Thanks for weighing in; it's not obvious to me yet that there's no way
to ask emacs --batch to --eval its way into initializing the X display,
but I may well end up reaching that conclusion after more digging.



  reply	other threads:[~2022-12-25 18:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-25 17:50 Working with colors in --batch mode Kévin Le Gouguec
2022-12-25 18:05 ` Eli Zaretskii
2022-12-25 18:22   ` Eli Zaretskii
2022-12-25 18:49     ` Kévin Le Gouguec [this message]
2022-12-26 17:40 ` Kévin Le Gouguec
2022-12-26 22:57   ` Stefan Monnier via Users list for the GNU Emacs text editor

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=877cyfiaj4.fsf@gmail.com \
    --to=kevin.legouguec@gmail.com \
    --cc=eliz@gnu.org \
    --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.
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).