0

I'm trying to enable 24bit support on the terminal (via SSH) on my FreeBSD 12 installation without success.
I tried to create a terminfo file with the contents:

xterm-24bit|xterm with 24-bit direct color mode,
   use=xterm-256color,
   sitm=\E[3m,
   ritm=\E[23m,
   setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
   setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,

And then executed the command (after installing ncurses):

$ tic -x -o ~/.terminfo xterm-24bit.terminfo

But when trying to run emacs, I get:

emacs: Cannot open terminfo database file

So, I tried to use infocmp -Cr to generate a termcap version and updated the db running:

# cap_mkdb /usr/share/misc/termcap

That almost worked, the emacs opens but black and white only :(

My terminal does support 24bit color and I use this mode via ssh on my other Linux machines. Does anybody uses 24 bit terminals on FreeBSD?

7
  • I do. I use the one that I wrote. (-: That really should not be the question here. You actually have three questions that this should ask: what needs to be done in the terminal database, what terminal database it in fact needs to be done in, and how to get emacs to recognize that. Commented Apr 16, 2019 at 19:26
  • It would only work if emacs is linked to an ncurses library using terminfo. But the FreeBSD emacs package links to the system ncurses, which is configured to use only termcap. You could configure/compile emacs yourself, but this group is of little use for advice on that sort of thing. Commented Apr 16, 2019 at 22:11
  • @ThomasDickey, I have compiled mine, but didn't know about linking to another ncurses library. I'll do some research about it. Thanks! Commented Apr 16, 2019 at 22:14
  • You might be able to use the ncurses port; I checked the system library by strings, looking for terminfo. Commented Apr 17, 2019 at 0:38
  • 1
    Recompiling the ncurses changing some flags (like removing --enable-termcap) and recompiling emacs only with --without-x flag did the trick! Thank you very much @ThomasDickey! Commented Apr 17, 2019 at 20:55

2 Answers 2

2

I have followed @Rafael Gil suggestions to recompile emacs, however, I have used the ports collection for both ncurses and emacs. For the benefit of those who might be still looking for a solution to this issue, this is what worked for me:

  • Fetched and extracted the ports collection as usual portsnap fetch extract etc
  • In /usr/ports/devel/ncurses manually edited its Makefile, line 23 that defines CONFIGURE_ARGS changing the hardcoded --enable-termcap to --disable-termcap as this was not a directly configurable option
  • make install then make clean
  • Using /usr/ports/editors/emacs compiled and installed emacs without X11 using make FLAVOR=nox install then make clean
  • I found it necessary to add the compiled xterm-24bit terminfo file to the shared system one, rather than the user home directory—utilities including emacs where not seeing the definition in the home directory. In other words I had to use sudo tic -x -s xterm-24bit.terminfo which writes the entries to /usr/local/share/misc/terminfo.db on my FreeBSD 12.1.
  • To launch it I have an alias to env TERM=xterm-24bit emacsclient, and I have installed the same terminfo using tic as at the top of this question.

It works, and I now have 24bit color, so I can use the solarized-dark and light themes in a remote FreeBSD shell session via ssh from iTerm on macOS.

I wonder if there is an easier solution to all of this—I do not fancy recompiling it all at every update etc. Any comments or suggestions would be much appreciated. BY the way, this is all related to this Github issue related to the solarized theme.

0

Recompiled the ncurses with --disable-termcap; Then recompiled emacs directly from the tarball (not from ports) That worked as expected. Thanks, @ThomasDickey for showing me a path to follow :)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.