[ESS] ANSI escape sequences in ESS

Vitalie Spinu @p|nuv|t @end|ng |rom gm@||@com
Mon May 11 01:23:07 CEST 2015


We are not even getting those delimiters because TERM var is "dumb" by
default. You can either:

  Sys.setenv(TERM = "xterm-256color")

directly in R, or prepend that to process-environment in emacs.

 Vitalie


 >>> Tamas Papp on Sun, 10 May 2015 17:28:49 +0200 wrote:

 > On Fri, May 08 2015, Vitalie Spinu <spinuvit using gmail.com> wrote:

 >> >>> Tamas Papp on Fri, 08 May 2015 13:23:54 +0200 wrote:
 >> 
 >> > Hi,
 >> > I saw some R packages that implement ANSI escapes in R and Julia, eg
 >> > https://github.com/gaborcsardi/crayon . But when I tried this in ESS/R,
 >> > the output was unchanged, in Julia I saw the escapes.
 >> 
 >> There is ansi-color-process-output in comint-output-filter-functions so
 >> it should work in principle. But, as R is not producing any of shush, it
 >> was never tested.
 >> 
 >> If you give a small reproducible example that works in terminal but not
 >> in ESS, I might have a look at it.

 > Hi Vitalie,

 > This works in the terminal, but not in Emacs/ESS (versions below):

 > install.packages("crayon")
 > library(crayon)
 > cat(green("test\n"))

 > Should print "test" in green.

 > Thanks for looking into this.

 > Best,

 > Tamas

 > PS.: Versions:

 > GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5) of
 > 2015-03-07 on trouble, modified by Debian

 > ess-version: 15.09-devel [elpa: 20150423.923] (loaded from /home/tamas/.emacs.d/elpa/ess-20150423.923/)

 > R version:
 >                _                           
 > platform       x86_64-pc-linux-gnu         
 > arch           x86_64                      
 > os             linux-gnu                   
 > system         x86_64, linux-gnu           
 > status                                     
 > major          3                           
 > minor          2.0                         
 > year           2015                        
 > month          04                          
 > day            16                          
 > svn rev        68180                       
 > language       R                           
 > version.string R version 3.2.0 (2015-04-16)
 > nickname       Full of Ingredients         

 > Crayon: 2015-04-09 00:30:34




More information about the ESS-help mailing list