Stefan Monnier writes: > Tomas Hlavaty [2022-09-19 22:16:07] wrote: >> On Mon 19 Sep 2022 at 18:05, Thierry Volpiatto wrote: >>> (let* ((screen (shell-command-to-string "echo -n $DISPLAY")) >> would (getenv "DISPLAY") be better? > > BTW, the two will *usually* return the same result, except in the case > where the selected frame is a tty frame created via an `emacsclient`, in > which case the `DISPLAY` passed to the subprocess depends on the > `display` frame parameter. > > So better use (getenv "DISPLAY" (selected-frame)) if you want to > preserve the `shell-command-to-string` behavior. Yes, sure getenv is better, however here: From emacs (display-graphic-p)==t: (getenv "DISPLAY" (selected-frame)) => nil (getenv "DISPLAY") => ":0.0" From emacs -nw both return ":0.0". -- Thierry