unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* terminal capability querying
@ 2002-04-20  2:20 Miles Bader
  2002-04-20  7:08 ` Eli Zaretskii
  2002-04-21 20:02 ` Richard Stallman
  0 siblings, 2 replies; 8+ messages in thread
From: Miles Bader @ 2002-04-20  2:20 UTC (permalink / raw)


[I brought up this same subject a long time ago, duing the 21.1 pretest,
 but that wasn't the right time to think about such issues]

One feature that I think would be useful and easy to implement would be
the ability to query what capabilities (e.g., underlining, boldface) are
supported when emacs is running on a tty.

For instance, for widget input fields, the most natural appearance would
seem to be underlining (like a real paper form), but since we can never
be sure that a terminal supports it, the face used for widget fields
must be conservative and defaults to a rather garish colored background
on ttys (unlike X displays, many 8/16-color ttys have no subtle colors
that are really nice for such an application).

For the same reason, other faces default to using combinations of
attributes (e.g. underlined+bold+colored) on ttys, just to be safe.
This means that probably at least one of the used attributes is
supported by any given terminal, and so the face will stand out, but
it often ends up looking unnecessarily busy on terminals that happen to
support all of the used attributes.

So, I propose adding the ability to ask emacs _which_ of these
capabilities a display supports, both in lisp code and in `defface'
specifications.  [This might end up making increasing the number of
clauses in defface specifications; I have another idea to help control
it, but I'll talk about that in another message.]

Here's a proposed programmatic interface:

  (display-capable-p ATTRIBUTE &optional DISPLAY)

    Return non-nil if DISPLAY supports the face attribute ATTRIBUTE.

    ATTRIBUTE should be either the name of a face attribute, e.g.,
    `:weight', `:underline', etc., or a cons-cell or list containing a
    face attribute and a specific value for it, e.g., (:weight bold).

    If ATTRIBUTE is an attribute name, then non-nil is returned if the
    display supports any non-default value for that attribute.
    If ATTRIBUTE specifies a value as well, then non-nil is returned
    if the display supports either that specific value, or some
    non-default `close' value.

For defface specs, I propose adding a new defface test, `capable', that
has the same argument as `display-capable-p' (except that the two cases
can also be represented as either 1 or 2 args following the `capable'
keyword, instead of being either an atom or a list).

For instance, one might change the `italic' face to be like this:

(defface italic
  '(((capable :slant italic) :slant italic)
    ((capable :underline) :underline t)
    (t :slant italic))
  "Basic italic font."
  :group 'basic-faces)

as underlining is the conventional representation for italics when real
italics are not supported.

It's not at all hard to implement this, I think, so I will do so if no
one objects.

Comments?

Thanks,

-Miles

-- 
Saa, shall we dance?  (from a dance-class advertisement)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-04-22  0:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-20  2:20 terminal capability querying Miles Bader
2002-04-20  7:08 ` Eli Zaretskii
2002-04-20  8:12   ` Miles Bader
2002-04-20  9:31     ` Eli Zaretskii
2002-04-20  9:58       ` Miles Bader
2002-04-20 11:46         ` Eli Zaretskii
2002-04-21 20:02 ` Richard Stallman
2002-04-22  0:20   ` Miles Bader

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).