Closed hboetes closed 3 years ago
Here is a side by side example, the first is from magit in Emacs, which has full 256 colour support BTW. And the second is from terminator, whilst running git diff.
Hi @hboetes, let's get to the bottom of this. Do you see any within-line highlighting at all when using magit-delta
? In general you should (like the word "Copy" in the screenshot in the README).
What is the value of the variable xterm-color--support-truecolor
in your Emacs?
Here's something to try:
Capture some delta
output with its ANSI escape sequences:
git diff | delta > with-ansi-colors.txt
Open with-ansi-colors.txt
in Emacs. You should see lots of raw ANSI escape sequences in the emacs buffer, like ^[[38;5;4m
Do M-x xterm-color-colorize-buffer
. That should suddenly make colors appear: i.e. it converts all the raw ANSI color escape codes into Emacs text properties. Does it look right? It should look the same as in your terminal.
Hello Dan,
Thanks for your time:
xterm-color--support-truecolor is a variable defined in ‘xterm-color.el’. Its value is t
Here is the result from git diff, which looks perfectly splendid:
[image: image.png]
This is the result of the file with-ansi-colors.txt in emacs with xterm-color-colorize-buffer, which does something wrong.
[image: image.png]
Here is my init.el for reference: https://raw.githubusercontent.com/hboetes/configs/master/.config/emacs/init.el Which I also tried whilst commenting out:
(custom-theme-set-faces 'zenburn '(font-lock-comment-face ((t (:foreground "#DFAF8F")))) '(font-lock-comment-delimiter-face ((t (:foreground "#DFAF8F")))))
And I also commented out using the zenburn theme completely, with the same result.
% emacs --version GNU Emacs 28.0.50
./configure --with-x --with-x-toolkit=gtk --without-makeinfo --mandir=/usr/local/man
This is the result of the file with-ansi-colors.txt in emacs with xterm-color-colorize-buffer, which does something wrong.
Hi @hboetes, the formatting in your reply got messed up unfortunately, so I can't see your screenshot.
Could you try M-x xterm-color-test
please? Here's what I get:
Hello Dan, whilst running emacs as an X application it looks right, but whilst running in terminator I get this:
I tried the same in alacritty:
Sooo.... Which terminal are you using? And do you have a config file for that terminal which you might want to share?
Mine are over here: https://raw.githubusercontent.com/hboetes/configs/master/.config/alacritty/alacritty.yml https://raw.githubusercontent.com/hboetes/configs/master/.config/terminator/config
Hey @hboetes, the replies being sent by your mail client aren't getting formatted correctly in github! Would you be able to post them directly in the github web UI (or smartphone app)?
Sorry about that, I've updated the comments, the image links work but are not rendered, no idea what causes that.
OK, so that sounds like the problem is something to do with display of colors when emacs is running in a terminal emulator. Can you try running these color test scripts in your terminal emulator?
https://gitlab.com/gnachman/iterm2/-/raw/adhoc_3.3.20190827_203700/tests/24-bit-color.sh
https://github.com/atomontage/xterm-color/tree/master/tests
What is the value of the COLORTERM
and TERM
environment variables in your shell (echo $TERM
) and as seen by emacs (getenv "TERM")
?
(I don't use Emacs a terminal application.)
% echo $TERM
xterm-256color
% echo $COLORTERM
truecolor
getenv TERM returns dumb getenv COLORTERM returns [no match]
Great, so it looks like there's no problem with your terminal.
OK, I'm seeing the same as you when I run emacs as a terminal application (emacs -nw
): the xterm-color-test
output does not look correct:
I'm not sure why this is, and I'm not 100% sure what our expectations should be. @atomontage (author of xterm-color) do you have time to advise here? In a terminal emulator that is displaying 256 and truecolor colors correctly, should the xterm-color-test
results render correctly in an emacs -nw
?
Might this be of interest? https://www.gnu.org/software/emacs/manual/html_node/efaq/Colors-on-a-TTY.html
Well I'll be damned o_O, that did the trick!
Yeah! I just found the same.
OK, great. So I'll add a note to the README pointing to that emacs doc page for people who want to use magit-delta with emacs running in a terminal.
Thanks for exploring this avenue!
Just to show off everything works now, emacs on OpenBSD in tmux with full color support for delta. Yay!
I just changed the indenting of this line, displayed with
git diff
As you can see the spaces I added are hilighted. When I display the same change in magit, those added spaces are not highlighted.
How can I configure magit-delta to use the same hilighting as in the console?