Re: [ESS] How can one tell rlang not to mess up R session in ESS ?

2023-11-14 Thread Dirk Eddelbuettel via ESS-help


On 14 November 2023 at 12:03, Deepayan Sarkar wrote:
| Are you suggesting that we should not be getting that by default? I

As I wrote in my message starting the thread:

   Casual searching at the rlang repo doesn't reveal anything so pardon me for
   asking here but what is a simple way to tell rlang to NOT do fancy pants
   color error backtraces?  At least under the theme I use ("nord", for Emacs)
   it basically nixes readability by leaving a 'dark on dark' default.

I have nothing against occassional cutesy symbols (ie happy rcmdcheck user)
but I get rather unhappy each rlang decided to 'help' by rendering my current
R session unusable.

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] How can one tell rlang not to mess up R session in ESS ?

2023-11-14 Thread Deepayan Sarkar via ESS-help
On Tue, 14 Nov 2023 at 11:46, Dirk Eddelbuettel via ESS-help
 wrote:
>
>
> On 14 November 2023 at 17:22, Lionel Henry wrote:
> | Worth noting I'm using `xterm-color` instead of `ansi-color` in my
> | comint buffers. IIRC the latter (which is builtin) didn't support some
> | features. Not sure if that could explain the bad behaviour you've
> | observed.
>
> I was also thinking cli could take advantage of TERM. In ESS under x11 and on
> the terminal I seem to see
>
>   > Sys.getenv("TERM")
>   [1] "dumb"
>   >
>
> so I guess ESS (or Emacs?) overrides because I otherwise settled on TERM and
> BYOBY_TERM as screen-256color which is decent setting for Nord.
>
> Back to rlang and cli messing up sessions they maybe should leave alone:
> would the team consider not asking the user to set NO_COLOR and rather
> inspect the terminal info and refraining from damaging working setups?

Not that I know a lot about this, but...

Despite Sys.getenv("TERM") being "dumb", Emacs can actually handle
ANSI color codes, and, e.g., I get a nice red cross sign with

> cli::cli_alert_danger("stop")
✖ stop

(which is no longer red when I copy-and-paste).

Are you suggesting that we should not be getting that by default? I
know I can still probably force it by setting options(cli.ansi = TRUE,
cli.num_colors = 256) etc.

Best,
-Deepayan

>
> Best, Dirk
>
> --
> dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] How can one tell rlang not to mess up R session in ESS ?

2023-11-14 Thread Dirk Eddelbuettel via ESS-help


On 14 November 2023 at 17:22, Lionel Henry wrote:
| Worth noting I'm using `xterm-color` instead of `ansi-color` in my
| comint buffers. IIRC the latter (which is builtin) didn't support some
| features. Not sure if that could explain the bad behaviour you've
| observed.

I was also thinking cli could take advantage of TERM. In ESS under x11 and on
the terminal I seem to see

  > Sys.getenv("TERM")
  [1] "dumb"
  > 

so I guess ESS (or Emacs?) overrides because I otherwise settled on TERM and
BYOBY_TERM as screen-256color which is decent setting for Nord.

Back to rlang and cli messing up sessions they maybe should leave alone:
would the team consider not asking the user to set NO_COLOR and rather
inspect the terminal info and refraining from damaging working setups?

Best, Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] How can one tell rlang not to mess up R session in ESS ?

2023-11-14 Thread Dirk Eddelbuettel via ESS-help


On 13 November 2023 at 18:54, Lionel Henry wrote:
| > Do you use this instead of the nord theme, or on top of the nord
| > theme?  Can you (briefly) describe what it does / what you like about
| > this addition?
| 
| I use it on top. This snippet comes in between loading and activation:
| 
| ```
| (require 'nord-theme)
| (load-theme 'nord)
| 
| *snippet*
| 
| (enable-theme 'nord)
| ```

That is good!  I noticed for a while that loading nord interfered with
starting in daemon mode so I dialed things down a little / conditioned on
interactive or some other trick (I am still a complete Elisp noob).

| I have a bunch of other stuff defined in there, like:
| 
| ```
| (custom-theme-set-faces
|  'nord
|  `(tab-bar ((t (:background ,nord1 :height 1.0
|  `(tab-bar-tab ((t (:foreground ,nord6 :background ,nord9 :box
| (:line-width (4 . 2) :style flat-button)
|  `(tab-bar-tab-inactive ((t (:foreground ,nord9 :background ,nord3
| :box (:line-width (4 . 2) :style flat-button))
| ```
| 
| This might not be the best way of doing this, but it's been some years
| since I added this and it still works.
| 
| Let me know if you're still having trouble with cli theming in ESS
| (and you want it to work instead of disabling it). It might be worth
| discussing in an issue on Github in that case.

Haven't restarted yet but I resorted for the blunt-but-likely-effective

## No color from cli inside emacs
## 
https://cli.r-lib.org/reference/faq.html#how-do-i-turn-off-ansi-colors-and-styles-
if (Sys.getenv("INSIDE_EMACS") != "")
Sys.setenv(NO_COLOR="TRUE")

See next message. Part of me still thinks rlang and cli do this wrong by
ignoring available env vars.

Thanks for the help,  Dirk
 
| Best,
| Lionel
| 
| 
| On 11/13/23, Dirk Eddelbuettel  wrote:
| >
| > Thanks Lionel. I was pretty sure I could count on a non-empty intersection
| > between ESS and rlang...
| >
| > On 13 November 2023 at 17:20, Lionel Henry wrote:
| > | See the cli website for disabling colours:
| > |
| > 
https://cli.r-lib.org/reference/faq.html#how-do-i-turn-off-ansi-colors-and-styles-
| >
| > Drats. I though of crayon but not cli. I still get lost in your endlessly
| > twisted maze of package. One day.
| >
| > | I use nord-theme too and I see I have this in my config, in case that
| > helps
| > | (I trimmed down this snippet manually, there might be a typo):
| > |
| > | ```lisp
| > | (let ((class '((class color) (min-colors 89)))
| > |   (nord0 (if (nord-display-truecolor-or-graphic-p) "#2E3440" nil))
| > |   (nord1 (if (nord-display-truecolor-or-graphic-p) "#3B4252"
| > "black"))
| > |   (nord2 (if (nord-display-truecolor-or-graphic-p) "#434C5E"
| > "#434C5E"))
| > |   (nord3 (if (nord-display-truecolor-or-graphic-p) "#4C566A"
| > "brightblack"))
| > |   (nord4 (if (nord-display-truecolor-or-graphic-p) "#D8DEE9"
| > "#D8DEE9"))
| > |   (nord5 (if (nord-display-truecolor-or-graphic-p) "#E5E9F0"
| > "white"))
| > |   (nord6 (if (nord-display-truecolor-or-graphic-p) "#ECEFF4"
| > "brightwhite"))
| > |   (nord7 (if (nord-display-truecolor-or-graphic-p) "#8FBCBB" "cyan"))
| > |   (nord8 (if (nord-display-truecolor-or-graphic-p) "#88C0D0"
| > "brightcyan"))
| > |   (nord9 (if (nord-display-truecolor-or-graphic-p) "#81A1C1" "blue"))
| > |   (nord10 (if (nord-display-truecolor-or-graphic-p) "#5E81AC"
| > "brightblue"))
| > |   (nord11 (if (nord-display-truecolor-or-graphic-p) "#BF616A" "red"))
| > |   (nord12 (if (nord-display-truecolor-or-graphic-p) "#D08770"
| > | "brightyellow"))
| > |   (nord13 (if (nord-display-truecolor-or-graphic-p) "#EBCB8B"
| > "yellow"))
| > |   (nord14 (if (nord-display-truecolor-or-graphic-p) "#A3BE8C"
| > "green"))
| > |   (nord15 (if (nord-display-truecolor-or-graphic-p) "#B48EAD"
| > "magenta")))
| > |   (let ((ansi-colours (vector nord1 ; black
| > |   nord11; red
| > |   nord14; green
| > |   nord13; yellow
| > |   nord8 ; blue
| > |   nord15; magenta
| > |   nord7 ; cyan
| > |   nord5 ; white
| > |   )))
| > | (setq xterm-color-names ansi-colours)
| > | (custom-theme-set-variables
| > |  'nord
| > |  `(ansi-color-names-vector ,ansi-colours
| > | ```
| >
| > Great, will play later.  Do you use this instead of the nord theme, or on
| > top
| > of the nord theme?  Can you (briefly) describe what it does / what you like
| > about this addition?
| >
| > Thanks,  Dirk
| >
| > | Best,
| > | Lionel
| > |
| > |
| > | On 11/13/23, Dirk Eddelbuettel via ESS-help 
| > wrote:
| > | >
| > | > Casual searching at the rlang repo doesn't reveal anything so pardon me
| > for
| > | > asking here but what is a simple way to tell rlang to NOT do fancy
| > pants
| > | > color error 

Re: [ESS] How can one tell rlang not to mess up R session in ESS ?

2023-11-14 Thread Lionel Henry via ESS-help
Worth noting I'm using `xterm-color` instead of `ansi-color` in my
comint buffers. IIRC the latter (which is builtin) didn't support some
features. Not sure if that could explain the bad behaviour you've
observed.

Best,
Lionel

On 11/14/23, Martin Maechler via ESS-help  wrote:
>> Dirk Eddelbuettel via ESS-help
>> on Mon, 13 Nov 2023 10:00:26 -0600 writes:
>
> > Casual searching at the rlang repo doesn't reveal anything so pardon
> me for
> > asking here but what is a simple way to tell rlang to NOT do fancy
> pants
> > color error backtraces?  At least under the theme I use ("nord", for
> Emacs)
> > it basically nixes readability by leaving a 'dark on dark' default.
>
> I've noticed the same ... and was very frustrated.
> IIRC, I needed to restart R to get back to a usable *R* buffer.
>
> Martin
>
> > Thanks in advance for any pointers.
>
> > Dirk
>
> > --
> > dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] How can one tell rlang not to mess up R session in ESS ?

2023-11-14 Thread Martin Maechler via ESS-help
> Dirk Eddelbuettel via ESS-help 
> on Mon, 13 Nov 2023 10:00:26 -0600 writes:

> Casual searching at the rlang repo doesn't reveal anything so pardon me 
for
> asking here but what is a simple way to tell rlang to NOT do fancy pants
> color error backtraces?  At least under the theme I use ("nord", for 
Emacs)
> it basically nixes readability by leaving a 'dark on dark' default.

I've noticed the same ... and was very frustrated.
IIRC, I needed to restart R to get back to a usable *R* buffer.

Martin

> Thanks in advance for any pointers.

> Dirk

> -- 
> dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help