cli icon indicating copy to clipboard operation
cli copied to clipboard

In emacs_version(): NAs introduced by coercion

Open charmoniumQ opened this issue 1 year ago • 1 comments

> cli::num_ansi_colors()
[1] 256
Warning message:
In emacs_version() : NAs introduced by coercion
>

I've determined this is because emacs_version expects INSIDE_EMACS to be some kind of version string, but Emacs vterm sets INSIDE_EMACS to vterm.

Should we special case vterm in emacs_version?

charmoniumQ avatar Apr 24 '24 19:04 charmoniumQ

Well, that is a pretty nasty thing to do, I would say. They really should not do that. Now how are we supposed to determine the Emacs version?

Emacs sets the environment variable INSIDE_EMACS in the subshell to ‘version,comint’, where version is the Emacs version (e.g., ‘28.1’). Programs can check this variable to determine whether they are running inside an Emacs subshell.

https://www.gnu.org/software/emacs/manual/html_node/emacs/Interactive-Shell.html

In any case, I don't think we need to special case it, we can just return NA_integer_ if it is not a version number, and get rid of the warning. Would you like to submit a PR? (No pressure, really.)

gaborcsardi avatar Apr 24 '24 20:04 gaborcsardi