all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hrvoje Niksic <hniksic@xemacs.org>
Cc: algernon@midgard.debian.net, bug-gnu-emacs@gnu.org,
	psg@debian.org, 127943@bugs.debian.org
Subject: Re: Bug#127943: Bug in htmlize.el
Date: Sun, 21 Sep 2003 14:19:57 +0200	[thread overview]
Message-ID: <m3pthue3ki.fsf@hniksic.iskon.hr> (raw)
In-Reply-To: <9003-Sun21Sep2003143629+0300-eliz@elta.co.il> (Eli Zaretskii's message of "Sun, 21 Sep 2003 14:36:30 +0200")

"Eli Zaretskii" <eliz@elta.co.il> writes:

> No, Emacs [uses those names] by design.  unspecified-fg and
> unspecified-bg are the two colors that the color support uses on
> text terminal for the foreground and background colors that the
> terminal used before Emacs starts.  IIRC (and AFAIK) most Unix text
> terminals don't allow you to query them about those colors, so their
> names and RGB values are unknown to Emacs.

Ah, that does clear things up.  That also explains why this hasn't
been reported before -- not that many people use `htmlize' on an Emacs
started in a text terminal.

>> How is a Lisp program supposed to interpret "unspecified-fg" as
>> color?
>
> It depends on the context; I don't think there's one answer to that
> question.  Please tell more about the context in this particular
> case.  Specifically, why do you need to interpret the color names at
> all?

htmlize is generating HTML that, when rendered on a color-enabled
browser, looks like the contents of the buffer.  Specifically, it
inspect buffer's fonts and colors and encodes them to HTML as closely
as possible.  Since HTML colors are in RGB, htmlize must convert a
"face" to the corresponding foreground and background RGB string.  For
example, to format the RGB components of a face's foreground color, it
calls something like:

  (apply 'format "#%02x%02x%02x"
         (mapcar (lambda (arg) (/ arg 256))
                 (x-color-values (face-foreground FACE))))

The actual code is somewhat more complex, dealing with different Emacs
versions, and supporting `face-foreground' returning nil.

So far I haven't seen face-foreground report "unspecified-*".  I think
I'll just handle it like I do nil -- default to something a bit more
sensible than throwing an error at the user.

Thanks for the explanation.

>> Why don't these functions return nil instead?
>
> Because nil means no color at all.

I'm curious -- how is "no color" different than "default (unspecified)
color"?  Is the distinction ever useful?  After all, every terminal
has some form of color, even when you can't change it!  :-)

  reply	other threads:[~2003-09-21 12:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87r8njey31.fsf@cachemir.echo-net.net>
     [not found] ` <sxsn0y61kix.fsf@florida.arsdigita.de>
     [not found]   ` <1197.1063152238@mixed>
     [not found]     ` <m3znhd54dn.fsf@xemacs.org>
     [not found]       ` <83k784rl0h.wl%algernon@bonehunter.rulez.org>
     [not found]         ` <m365jnahp7.fsf@hniksic.iskon.hr>
     [not found]           ` <83ad8zryyx.wl%algernon@midgard.debian.net>
2003-09-20 20:40             ` Bug#127943: Bug in htmlize.el Hrvoje Niksic
2003-09-21 12:36               ` Eli Zaretskii
2003-09-21 12:19                 ` Hrvoje Niksic [this message]
2003-09-21 14:39                   ` Eli Zaretskii
2003-09-21 16:27                     ` Eli Zaretskii
2003-09-21 13:29               ` Richard Stallman

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=m3pthue3ki.fsf@hniksic.iskon.hr \
    --to=hniksic@xemacs.org \
    --cc=127943@bugs.debian.org \
    --cc=algernon@midgard.debian.net \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=psg@debian.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.