all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: jem <jere.mcdevitt@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: emacsclient frame reuse
Date: Tue, 4 Aug 2009 14:07:15 -0700 (PDT)	[thread overview]
Message-ID: <1c9c248b-a2e4-441a-9bd7-5ca49bc7694c@c1g2000yqi.googlegroups.com> (raw)

I've been testing the new 23 build and the --daemon option and have a
question how to get it to operate as I used to have gnuserv working.

Here's the scenario -- I have running in the background an emacs
instance using the --daemon flag.  Now, I want to edit a new file in
an X window frame so I have a script that will launch:

emacsclient -c -n file

This fires a new frame with the file and returns.  Now I want to edit
a second file, in the same frame.  If I use the same command

emacsclient -c -n file2

I get a new frame, where I wanted to share the previous frame.
Instead I have to use

emacsclient -n file2

to reuse the frame.

If I don't have any running frames (either TTY or X) and use the
emacsclient -n file command, there is a quick flash in the terminal
then it goes away as the client assumes TTY and the process
terminates.

I would like to have a single script that I can invoke that will do
the right thing.  If there is no visible frame, use the -c option.  If
there is a visible frame do not use the -c option.   The problem is, I
can't find a way to determine if there is a visible frame.  Because of
the -n option, the previous emacsclient process has exited.

In the older model with gnuserv I was able to add

(setq gnuserv-frame (car (frame-list)))

and my startup script looked like

gunclient -n $@ 2>/dev/null
if [ $? -ne 0 ]
then
       emacs $@ &
fi

which would start emacs if not started (I loaded gnuserv in the
init.el file) or connect to the existing one and share the frame.

How can you detect if there is already a running frame with the newest
version?

Thanks

Jere
~


             reply	other threads:[~2009-08-04 21:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-04 21:07 jem [this message]
2009-08-04 22:18 ` emacsclient frame reuse A.Politz
2009-08-05  0:22   ` jem
2009-08-05  0:40     ` jem

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=1c9c248b-a2e4-441a-9bd7-5ca49bc7694c@c1g2000yqi.googlegroups.com \
    --to=jere.mcdevitt@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.