Subject: Re: bug#33182: 26.1; Support for Suckless st(simple terminal)

From: Stefan Kangas <[email-masked]>
Date: Thu, 3 Oct 2019 02:59:33 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: "D. Ebling" <[email-masked]>
>> Date: Sat, 27 Oct 2018 20:15:26 -0300
>>
>>        Emacs on st detects 8 colors support, and st supports 256 and
>> 24-bits colors. Opening a file with "TERM=xterm-256colors emacs -q -nw
>> foo.bar" or using "(add-to-list 'term-file-aliases '("st-256color"
>> . "xterm"))" resolves the colors issue but introduces a 5 seconds delay
>> to load the file, if i open like this and after use only "emacs -q -nw
>> foo.bar" the 256 colors work and there's no delay to load the file, but
>> this only works if i used "TERM=xterm-256color" before.  st version is 0.8.1.
>
> I think this requires a new st.el file in the lisp/term/ directory,
> which will tell Emacs that st handles 256 colors, but not the extended
> xterm commands (whose queries I'm guessing are the reason for the
> delay).
>
> Patches welcome.

I couldn't reproduce the issue with the delay neither on st version
0.8.1 or 0.8.2.

In any case, I took a simplistic stab at this.  I can now run
"emacs -Q -nw" without specifying term and I get 256 colors as shown
by M-x list-colors-display.

Could you test it and see if it works for you?  You didn't mention
which version of Emacs you're using, but I would recommend to test
this on the current master branch (the development version 27.0.50).

Best regards,
Stefan Kangas
From dfb6f43b1746fb21dfe9a7feb60607cc54749a4e Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Thu, 3 Oct 2019 02:46:44 +0200
Subject: [PATCH] Add term/st.el

This is a copy of term/konsole.el with konsole -> st.
* lisp/term/st.el: New file.
---
 lisp/term/st.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 lisp/term/st.el

diff --git a/lisp/term/st.el b/lisp/term/st.el
new file mode 100644
index 0000000000..d51e363d69
--- /dev/null
+++ b/lisp/term/st.el
@@ -0,0 +1,12 @@
+;;; st.el --- terminal initialization for st
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+(require 'term/xterm)
+
+(defun terminal-init-st ()
+  "Terminal initialization function for st."
+  (tty-run-terminal-initialization (selected-frame) "xterm"))
+
+(provide 'term/st)
+
+;; st.el ends here
-- 
2.20.1