all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: How to get DISPLAY of emacsclient?
Date: Mon, 28 Nov 2022 17:15:28 +0000	[thread overview]
Message-ID: <338f50d42149668a6b3a@heytings.org> (raw)
In-Reply-To: <tm2kc3$2ov$1@ciao.gmane.io>


>
> I was seeking a way to avoid creation a visible frame and to call a 
> function that does not work without X connection.
>
> So I should thank Jim again for drawing my attention why the effect of 
> the --display option is stronger than for the DISPLAY environment. This 
> option indirectly solves the problem.
>

I still think this is an ill-posed problem, so here are a few additional 
thoughs, in case you find them useful.  There are at least three cases:

1. "emacsclient --eval '(+ 1 1)'" does NOT use a display: it is evaluated 
in the server process.  You can use '(getenv DISPLAY)' there, but it will 
not return any useful information, it will return the value of DISPLAY 
that was current when the Emacs daemon was created.

2. "emacsclient -c", which creates a frame on the display specified in the 
environment variable DISPLAY (if DISPLAY is unset, "emacsclient -c" is 
equivalent to "emacsclient -nw").

3. "emacsclient --display <DISPLAY> -c", which creates a frame on the 
specified display <DISPLAY>; it is equivalent to "env DISPLAY=<DISPLAY> 
emacsclient -c".

If you want to know the value if the environment variable DISPLAY in case 
1, the best way to do that is to explicitly include "$DISPLAY" in the form 
you evaluate, e.g. like this:

emacsclient --eval '(progn (setq display "'$DISPLAY'") (princ display))'



  reply	other threads:[~2022-11-28 17:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 15:17 How to get DISPLAY of emacsclient? Max Nikulin
2022-11-25 16:57 ` Stefan Monnier
2022-11-26  3:36   ` Max Nikulin
2022-11-26 21:33     ` chad
2022-11-27 11:34       ` Max Nikulin
2022-11-27 13:42         ` Gregory Heytings
2022-11-27 14:23           ` Max Nikulin
2022-11-27 14:38             ` Gregory Heytings
2022-11-27 15:26               ` Max Nikulin
2022-11-27 16:12                 ` Gregory Heytings
2022-11-28  1:19             ` Po Lu
2022-11-27 20:36     ` Jim Porter
2022-11-28 15:33       ` Max Nikulin
2022-11-28 17:15         ` Gregory Heytings [this message]
2022-11-28 18:19         ` Stefan Monnier
2022-11-29 16:23           ` Max Nikulin
2022-11-30  0:41             ` chad
2022-11-30  2:44               ` Stefan Monnier
2022-11-30 12:47                 ` Max Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=338f50d42149668a6b3a@heytings.org \
    --to=gregory@heytings.org \
    --cc=emacs-devel@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.