all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* making emacsclient create/destroy a frame
@ 2003-10-13 21:24 Roland Roberts
  2003-10-14 16:16 ` Reto Zimmermann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Roland Roberts @ 2003-10-13 21:24 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----

I'm trying to figure out a way to make "emacsclient FOO" create a new
frame for editing FOO, then have C-x # destroy the frame.  It's
sort-of working....


    (delete-frame
     (setq server-window (make-frame)))

    (defun rbr:server-done-hook ()
      (if (boundp 'server-window)
          (delete-frame server-window)))

    (setq server-done-hook 'rbr:server-done-hook)

Okay, the first thing is creating and destroying the initial frame is
kludgey beyond words, but once done makes server-switch-buffer do the
right thing.  Almost.

Although rbr:server-done-hook destroys the frame, server-switch-buffer
creates a new one when it tries to pop back to the pre-server edit
configuration.

I was hoping I could get away with just setting some variable, but at
this point I'm browsing the code in server.el trying to figure out
what I have to do.  Has anyone done this before and can give me a
clue?

TIA,

roland
- -- 
		       PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                             RL Enterprises
roland@rlenter.com                            6818 Madeline Court
roland@astrofoto.org                           Brooklyn, NY 11220

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
Comment: Processed by Mailcrypt 3.5.4, an Emacs/PGP interface

iQCVAwUBP4sYKuoW38lmvDvNAQF5oAQAqaY9Mq9F/NNkkad3/zmeO/43RgLmIn9S
ywDrZwGkD++yfgnqKxs3EbKsvVO/69Hcl+zHpMfVh2ek+S8pfL93Ali6eU/XKd+o
lU8moynoOLJhnmjFpJmH5gX2uTCTev2fQotb2ArPfpT/6VcejXIUqy3853qF0pVh
0MJDlCPSrzE=
=v21s
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: making emacsclient create/destroy a frame
  2003-10-13 21:24 making emacsclient create/destroy a frame Roland Roberts
@ 2003-10-14 16:16 ` Reto Zimmermann
  2003-10-14 16:37 ` Glenn Morris
  2003-10-14 18:24 ` Glenn Morris
  2 siblings, 0 replies; 5+ messages in thread
From: Reto Zimmermann @ 2003-10-14 16:16 UTC (permalink / raw)


Roland Roberts wrote:

> I'm trying to figure out a way to make "emacsclient FOO" create a new
> frame for editing FOO, then have C-x # destroy the frame.  It's
> sort-of working....

You can use gnuserv instead, which comes with more features including 
opening files in a new frame.  But you need to install it first.

Reto

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: making emacsclient create/destroy a frame
  2003-10-13 21:24 making emacsclient create/destroy a frame Roland Roberts
  2003-10-14 16:16 ` Reto Zimmermann
@ 2003-10-14 16:37 ` Glenn Morris
  2003-10-14 20:02   ` Roland Roberts
  2003-10-14 18:24 ` Glenn Morris
  2 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2003-10-14 16:37 UTC (permalink / raw)


Roland Roberts wrote:

> Although rbr:server-done-hook destroys the frame, server-switch-buffer
> creates a new one when it tries to pop back to the pre-server edit
> configuration.
>
> I was hoping I could get away with just setting some variable, but at
> this point I'm browsing the code in server.el trying to figure out
> what I have to do.  Has anyone done this before and can give me a
> clue?

Have your server-done-hook function set server-window to nil after it
destroys the server-window frame.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: making emacsclient create/destroy a frame
  2003-10-13 21:24 making emacsclient create/destroy a frame Roland Roberts
  2003-10-14 16:16 ` Reto Zimmermann
  2003-10-14 16:37 ` Glenn Morris
@ 2003-10-14 18:24 ` Glenn Morris
  2 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2003-10-14 18:24 UTC (permalink / raw)


Roland Roberts wrote:

> I'm trying to figure out a way to make "emacsclient FOO" create a new
> frame for editing FOO, then have C-x # destroy the frame.  It's
> sort-of working....
>
>
>     (delete-frame
>      (setq server-window (make-frame)))

Oh, I didn't understand what this bit of code was for until now.

>     (defun rbr:server-done-hook ()
>       (if (boundp 'server-window)
>           (delete-frame server-window)))
>
>     (setq server-done-hook 'rbr:server-done-hook)
>
> Okay, the first thing is creating and destroying the initial frame is
> kludgey beyond words, but once done makes server-switch-buffer do the
> right thing.

Does the following strike you as any less kludgey?

(add-hook 'server-visit-hook
            '(lambda ()
               (setq server-window (make-frame))))

(add-hook 'server-done-hook
            '(lambda ()
               ;; Insert boundp safety test, etc, if being thorough.
               (delete-frame server-window)
               (setq server-window nil)))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: making emacsclient create/destroy a frame
  2003-10-14 16:37 ` Glenn Morris
@ 2003-10-14 20:02   ` Roland Roberts
  0 siblings, 0 replies; 5+ messages in thread
From: Roland Roberts @ 2003-10-14 20:02 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----

Thanks to all who replied; the following combination does the trick:

    (defun rbr:server-visit-hook ()
      (setq server-window (make-frame)))

    (defun rbr:server-done-hook ()
          (cond ((and (boundp 'server-window)
                      (framep server-window))
                 (delete-frame server-window)
                 (setq server-window nil))))

    (setq server-done-hook 'rbr:server-done-hook)

    (setq server-visit-hook 'rbr:server-visit-hook)

roland
- -- 
		       PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                             RL Enterprises
roland@rlenter.com                            6818 Madeline Court
roland@astrofoto.org                           Brooklyn, NY 11220

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
Comment: Processed by Mailcrypt 3.5.4, an Emacs/PGP interface

iQCVAwUBP4xWOuoW38lmvDvNAQFynQP+PVav/cHHeoXXY5Hcf4DpzhQG7RPMw+ii
0rjG2d3PihoXPxClmmZpkyRr75ePGUMfCSPssecnup/J8dDeSgqwbMzRZbjGHiAU
IoY96Qs3fiAFtsJw3RmN4HxHzpo20MEFLAFc4a1h4g4X71hUlUgWoY/KLP/6FL9/
D9NkE8AVT84=
=RXtc
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-10-14 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-13 21:24 making emacsclient create/destroy a frame Roland Roberts
2003-10-14 16:16 ` Reto Zimmermann
2003-10-14 16:37 ` Glenn Morris
2003-10-14 20:02   ` Roland Roberts
2003-10-14 18:24 ` Glenn Morris

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.