New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Printing a tibble removes all text faces #1193
Comments
I'm having the same issue. I had just before updated to emacs 28.1 (on Manjaro 21.2.6), so perhaps changes there are responsible for this bug. Edit: After downgrading to 27.2 tibbles are printed correctly again. |
I'm having the same problem on Windows 10, Emacs 28.1. It also seems to happen after printing error messages written by rlang:
And here's output from the second
|
I'm having the same issue for tibble and rlang output. the "ansi-color-freeze-overlay" is also present for me. Emacs version 28.1 |
Same for me; and thx @jsahrma for the diagnostic procedure :) Emacs 28.1 |
Note that a workaround is to change the tibble print options:
The |
@maxecharel Thank you for the solution you found! I have it working for the case of printing a tibble. Any idea how to hack away this issue too? emacs-version "28.1" |
Setting I set both hacks in my .Rprofile file on the home directory so they take effect by default. @maxecharel Thanks for the pointer! |
thanks for the solutions so far! I've come across this behavior in another occasion, namely warnings that don't throw an error: does someone know which option to change to fix this as well? Edit: I posted this point because the issue (removal of text faces) was the same as in the original post, and since this issue had been discussed in relation to other aspects than printing tibbles (errors) I thought text face removal in the case of warnings was relevant here as well. Should I make a separate issue for it? |
This comment was marked as off-topic.
This comment was marked as off-topic.
@lionel- sorry if it wasn't clear, by fixing I didn't mean avoiding the warning itself, but that the warning removes faces for all subsequent text. |
By the way as a stopgap you can clone this branch of xterm-color locally: https://github.com/lionel-/xterm-color/tree/patches Here is my config: (use-package xterm-color
:load-path "PATH-TO-xterm-color"
:init
(setq comint-output-filter-functions
(remove 'ansi-color-process-output comint-output-filter-functions))
(add-hook 'inferior-ess-mode-hook
(lambda () (add-hook 'comint-preoutput-filter-functions #'xterm-color-filter nil t)))
:config
(setq xterm-color-use-bold t)) |
@lionel- thx for the workaround, will certainly try it. Does it mean that the issue comes from ansi-color.el and thus cannot be solved by patching ESS? |
I haven't looked into it (I don't have any time to work on ESS lately, I'm hoping next year will be less busy) but this would be my guess. |
Works like a charm (at least when printing tibble), thanks again @lionel- . Out of curiosity, does |
IIRC it supports more ANSI escapes. |
Simplest fix seems to be to run (defun my-inferior-ess-init ()
(setq-local ansi-color-for-comint-mode 'filter)
(smartparens-mode 1))
(add-hook 'inferior-ess-mode-hook 'my-inferior-ess-init) |
Thank you, @Fuco1. From what I read here (and in #1199) it seems we (i.e. |
@Fuco1 This strips all ANSI escapes instead of decorating the text right? I'm not sure this should be the default in ESS, this seems like this should be set in user configs. So I would not call this a fix for Emacs 28, but rather a temporary stopgap until a proper fix is found. |
Probably the historical behaviour is the right solution. It used to be that the font-locking isn't applied on ansi-colourised output. This is still the case in my local config. |
On Emacs 28 and the change of how ansi colors are handled, it made all text black and unreadable. See emacs-ess/ESS#1193
This isn't a complete solution, but you can tell R to print an ANSI reset code after every command, before the next prompt: invisible(addTaskCallback(function(...) {
if (interactive()) {
# Remember to install crayon
try(cat(crayon::reset("")), silent = TRUE)
}
TRUE
}, name = "ansi_reset")) This doesn't fix the coloring of the output of the offending commands, but it does prevent it from leaking into subsequent commands, at least in my Emacs. |
Shouldn't this be the default setting in R itself? Like I can't think of any reason anscii reset isn't done in a prompt causing previous output to leak into the next one. Also, where do you put that code? Sorry I'm new to R, is there a config file like file that you can place that'll be loaded for all R sessions? |
You put it in |
FYI, if you use |
@cddesja It should be possible to add an extra check for this, e.g. only printing the reset code if standard output is a terminal or something like that. |
For org-mode users: this issue also affects output blocks from interactive ob-R sessions. Unfortunately, @Fuco1 's solution to set Luckily, @lionel- 's solution to use It's not necessary to use @lionel- 's patched fork; I found the upstream Here's my config for this:
|
I have nothing to add to the solution (the one provided by @jackkamm worked very well for me), but I wanted to express my gratitude to the team maintaining ESS. I want to commend not only a great software, but also an amazingly helpful community. |
This bug was also affecting me but I can no longer reproduce it when upgrading to Emacs 29.1 from Emacs 28.2. |
I've observed the same problems with tibbles, tidymodels outputs, and messages and warnings that your already mentioned. So, as suggested by @lionel-, I added
Now all outputs are in appropriate font face. |
It seems that anytime I print a tibble, the text highlights, coloring are shut off for the rest of the session.
I'm using a cyberpunk theme in the screenshots, but even if I disable the theme, the text faces will still change after the tibble printing. This change has nothing to do with the theme.
I'm using:
MacOS 12.3
Emacs 28.0
ESS:20220225.1523
Any help would be appreciated!!
The text was updated successfully, but these errors were encountered: