all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: chohag@jtan.com
Cc: 69598@debbugs.gnu.org
Subject: bug#69598: 29.2; colour support based on $TERM value not terminfo database
Date: Fri, 08 Mar 2024 17:09:51 +0200	[thread overview]
Message-ID: <86sf10zrnk.fsf@gnu.org> (raw)
In-Reply-To: <202403081423.428ENSpk162347@zeus.jtan.com> (chohag@jtan.com)

> From: chohag@jtan.com
> cc: chohag@jtan.com, 69598@debbugs.gnu.org
> Comments: In-reply-to Eli Zaretskii <eliz@gnu.org>
>    message dated "Fri, 08 Mar 2024 14:22:52 +0200."
> Date: Fri, 08 Mar 2024 14:23:26 +0000
> 
> > > If we're at the point where the terminal's name matters one jot,
> > > that is to say when the value of $TERM is used for _anything_ other
> > > than selecting a terminfo entry, that is a bug.
> >
> > It is not necessarily a bug.  Emacs needs to be able to convert
> 
> It's a problem inasmuch as it is a violation of the terminfo protocol
> and takes a sharp turn into non-standards territory. Perhaps bug
> is not the best term. It's certainly a red flag.

We only do that for handling the colors, and I'm not sure I can see
how terminfo can help us here.  terminfo knows how many colors a
terminal supports and which escape sequences to use for that, but it
doesn't know which colors will be produced, in terms of the RGB
triplets.  So Emacs needs something else to support colors on text
terminals, and that something comes from the lisp/term/ files.  Those
files also set up Emacs for various non-standard function keys
produced by the terminal, and support other features, like copy/paste
etc.

So these files are not a bug, they are the foundation of several
important features in Emacs.

> > X-style color names to escape sequences it should send to the terminal
> > to produce a similar color.  That conversion is specific to the
> > terminal, so Emacs relies on the name of the terminal to set up the
> > conversion.
> 
> Hmm. If only there was some sort of database that described
> terminal-specific capabilities and features and how to use them.
> It could also ensure the programs were portable, even to terminals
> that haven't been created yet!

Yes.  But AFAIK there's no such database, so Emacs must use its own
database.

> > This is not enough.  You need also to change this line at the end of
> > notworking.el:
> >
> >   (provide 'term/xterm)
> >
> > to say
> >
> >   (provide 'term/notworking)
> >
> > Sorry I didn't mention this before.
> 
> No worries. It still makes no difference though unfortunately.
> 
> But to be thorough I changed all instances of xterm in that
> notworking.el to notworking and that did work. After a few minutes
> I isolated the change to renaming terminal-init-xterm to
> terminal-init-notworking. In fact that's the only change that needs
> to be made: This diff is sufficient:
>         
>         --- lisp/term/xterm.el  Sat Jan  6 12:56:30 2024
>         +++ lisp/term/notworking.el     Fri Mar  8 14:00:28 2024
>         @@ -913,7 +913,7 @@
>            ;; We likewise unconditionally enable support for focus tracking.
>            (xterm--init-focus-tracking))
> 
>         -(defun terminal-init-xterm ()
>         +(defun terminal-init-notworking ()
>            "Terminal initialization function for xterm."
>            (unwind-protect
>                (progn
> 
> I was actually a little surprised when I changed the provide line
> back to 'term/xterm and it continued to work but this agrees with
> lisp/term/README.

So you now agree with me that a terminal file in lisp/term is needed
for this situation?  Or are there issues that are still unaccounted
for, as far as color support is concerned?

> That explains why the workaround of using a terminal name beginning
> with xterm- works. It doesn't explain why that is necessary and
> using setb24/setf24, the RGB capability and/or COLORTERM=truecolor
> is insufficient (ie. it doesn't explain why the terminal name
> _matters_).

I hope what I wrote above explains that.  If you read the code in
xterm.el, I think you will understand it.  The other part of the
color-related support is in lisp/term/tty-colors.el, btw.





  reply	other threads:[~2024-03-08 15:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 23:01 bug#69598: 29.2; colour support based on $TERM value not terminfo database chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07  6:47 ` Eli Zaretskii
2024-03-07 17:32   ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 17:47     ` Eli Zaretskii
2024-03-07 18:31       ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 19:26         ` Eli Zaretskii
2024-03-07 19:59           ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 20:10             ` Eli Zaretskii
2024-03-07 21:45               ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 21:50                 ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08  7:11                 ` Eli Zaretskii
2024-03-08 11:36                   ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 12:22                     ` Eli Zaretskii
2024-03-08 14:23                       ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 15:09                         ` Eli Zaretskii [this message]
2024-03-08 18:52                           ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 19:50                             ` Eli Zaretskii
2024-03-08 21:13                               ` chohag--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-09  7:18                                 ` Eli Zaretskii
2024-03-21  8:33                                   ` Eli Zaretskii

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=86sf10zrnk.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=69598@debbugs.gnu.org \
    --cc=chohag@jtan.com \
    /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.