all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* possible to exchange server and client?
@ 2008-07-13  1:10 anhnmncb
  2008-07-13 20:13 ` Peter Dyballa
  0 siblings, 1 reply; 18+ messages in thread
From: anhnmncb @ 2008-07-13  1:10 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, list:
Pardon for my poor English :)

mtty is buggy in org-mode, so I think use server is the right way. Now I
have to run server in console and use client in X to prevent quit X with
emacs.

So it would be very useful if I can exchange the client to server, and
old server becomes client, then I can use server in X, then I want to
quit X without emacs, I open a emacsclient in console, make it be
server, then quit X.

I know in this condition, it can't prevent emacs from X crash, but
I don't too care.
-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

* Re: possible to exchange server and client?
  2008-07-13  1:10 possible to exchange server and client? anhnmncb
@ 2008-07-13 20:13 ` Peter Dyballa
  2008-07-14  0:20   ` anhnmncb
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2008-07-13 20:13 UTC (permalink / raw)
  To: anhnmncb; +Cc: help-gnu-emacs


Am 13.07.2008 um 03:10 schrieb anhnmncb:

> So it would be very useful if I can exchange the client to server, and
> old server becomes client, then I can use server in X, then I want to
> quit X without emacs, I open a emacsclient in console, make it be
> server, then quit X.

I don't exactly understand what you intend to do. And wish to have.  
When you're using a version of GNU Emacs with the multi-tty patch  
included, i.e., GNU Emacs 23.0.60 from CVS, it works to have "frames"  
of this version open in a windowing system and in an alphanumeric  
terminal emulation. So, in other words, it should work to launch GNU  
Emacs 23.0.60 in your console, start the server, and then open frames  
in X11 with emacsclient, just use -d <display> as an extra argument.

--
Greetings

   Pete

We are usually convinced more easily by reasons we have found  
ourselves than by those which have occurred to others.
				– Blaise Pascal







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

* Re: possible to exchange server and client?
  2008-07-13 20:13 ` Peter Dyballa
@ 2008-07-14  0:20   ` anhnmncb
  2008-07-14  7:48     ` Peter Dyballa
       [not found]     ` <mailman.14687.1216021747.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 18+ messages in thread
From: anhnmncb @ 2008-07-14  0:20 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 13.07.2008 um 03:10 schrieb anhnmncb:
>
>> So it would be very useful if I can exchange the client to server, and
>> old server becomes client, then I can use server in X, then I want to
>> quit X without emacs, I open a emacsclient in console, make it be
>> server, then quit X.
>
> I don't exactly understand what you intend to do. And wish to have.
> When you're using a version of GNU Emacs with the multi-tty patch
> included, i.e., GNU Emacs 23.0.60 from CVS, it works to have "frames"
> of this version open in a windowing system and in an alphanumeric
> terminal emulation. So, in other words, it should work to launch GNU
> Emacs 23.0.60 in your console, start the server, and then open frames
> in X11 with emacsclient, just use -d <display> as an extra argument.
Pardon for my poor English, my emacs version is
  GNU Emacs 23.0.60.1 (i686-pc-linux-gnu) of 2008-07-13 on gentoo

I have this thought because emacs server works better than emacsclient.
An example: I start emacs server in a dtach session in console, and use
emacsclient in Xorg. But I meet bug when using org-mode with
emacsclient, emacs server works well though. So if I want org-mode works
well, I have to use emacs server.

But when I run emacs server on Xorg, in this case, it becomes impossible
if I want to restart Xorg without quiting emacs. So I want to know, in
this condition, if I can start an emacsclient in console, then let it
become server(old emacs server on Xorg becomes client now), then close
the emacs(old server) on Xorg, restart Xorg, run emacsclient, let it
become server again? If can, I can restart Xorg without quiting emacs.

Don't know if this time I express myself clearly, if not, please let me
know.
-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

* Re: possible to exchange server and client?
  2008-07-14  0:20   ` anhnmncb
@ 2008-07-14  7:48     ` Peter Dyballa
  2008-07-14  9:40       ` anhnmncb
       [not found]       ` <mailman.14692.1216028482.18990.help-gnu-emacs@gnu.org>
       [not found]     ` <mailman.14687.1216021747.18990.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 18+ messages in thread
From: Peter Dyballa @ 2008-07-14  7:48 UTC (permalink / raw)
  To: anhnmncb; +Cc: help-gnu-emacs


Am 14.07.2008 um 02:20 schrieb anhnmncb:

> So I want to know, in this condition, if I can start an emacsclient  
> in console, then let it become server(old emacs server on Xorg  
> becomes client now), then close the emacs(old server) on Xorg,  
> restart Xorg, run emacsclient, let it become server again?

With an un-patched GNU Emacs you can't start GNU Emacs via  
emacsclient. When emacsclient can't contact a running server, it will  
tell you this and quit. So you need to launch GNU Emacs.

There can't be a difference between a server started from GNU Emacs  
running in some terminal emulation or being the client of some window  
system just as a spoon is a spoon, no matter whether it's in your  
mouth, in a drawer, in a dish-washer, or in a shop.

> If can, I can restart Xorg without quitting emacs.


As long as GNU Emacs keeps running in some terminal emulation that  
survives stopping of the X server and that is (again) authorised to  
contact the new X server and open clients on this display, it should  
work.

Me, I can't see how the terminal emulation can survive X server's  
end. You're logging in without window system and you're starting it  
by hand?


Another option is to use session and desktop. These can re-establish  
GNU Emacs's state before it was quit. The only problem is that you  
have to quit GNU Emacs by hand. If it receives a signal from the  
crashing or quitting X server, it does not save the recent state. At  
least I have not found a way to achieve this ...

--
Greetings

   Pete

People say that if you play Microsoft CD's backwards, you hear  
satanic things, but that's nothing, because if you play them  
forwards, they install MS Windows.





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

* Re: possible to exchange server and client?
  2008-07-14  7:48     ` Peter Dyballa
@ 2008-07-14  9:40       ` anhnmncb
  2008-07-14 11:47         ` Peter Dyballa
       [not found]       ` <mailman.14692.1216028482.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 18+ messages in thread
From: anhnmncb @ 2008-07-14  9:40 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 14.07.2008 um 02:20 schrieb anhnmncb:
>
>> So I want to know, in this condition, if I can start an emacsclient
>> in console, then let it become server(old emacs server on Xorg
>> becomes client now), then close the emacs(old server) on Xorg,
>> restart Xorg, run emacsclient, let it become server again?
>
> With an un-patched GNU Emacs you can't start GNU Emacs via
> emacsclient. When emacsclient can't contact a running server, it will
> tell you this and quit. So you need to launch GNU Emacs.

I didn't mean start emacs via emacsclient, I meant *in this
condition* which emacs server has started in Xorg.

>
> There can't be a difference between a server started from GNU Emacs
> running in some terminal emulation or being the client of some window
> system just as a spoon is a spoon, no matter whether it's in your
> mouth, in a drawer, in a dish-washer, or in a shop.

But there has been. See two screenshots, first is org-mode in emacs
server, which is running in the dtach sesstion on urxvt; second is
org-mode in emacsclient which is with the same emacs server:
            http://paste.ubuntu.org.cn/i8055
            http://paste.ubuntu.org.cn/i8054
You can see, in emacsclient, the column view can't display properly,
it's not relative to the color-theme. Emacs server works well.

>> If can, I can restart Xorg without quitting emacs.
>
>
> As long as GNU Emacs keeps running in some terminal emulation that
> survives stopping of the X server and that is (again) authorised to
> contact the new X server and open clients on this display, it should
> work.
>
> Me, I can't see how the terminal emulation can survive X server's end.
> You're logging in without window system and you're starting it  by
> hand?
>
>
> Another option is to use session and desktop. These can re-establish
> GNU Emacs's state before it was quit. The only problem is that you
> have to quit GNU Emacs by hand. If it receives a signal from the
> crashing or quitting X server, it does not save the recent state. At
> least I have not found a way to achieve this ...

I think my words have misled you, sorry.

I start emacs server in console(differ it with x terminal), and use
emacsclient on xorg. But you see, emacsclient has something wrong with
org-mode's column view. So I want to use emacs server instead of
emacsclient. 

(hmm, maybe I got why you can't understand me, what I mean emacs server,
is that the server frame, emacsclient is the client frame.)

Now what I want is: Start emacs server on xorg, then run an emacsclient
in console and make it to be a server, so the old client becomes new
server and the old server becomes client?

-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

* Re: possible to exchange server and client?
       [not found]     ` <mailman.14687.1216021747.18990.help-gnu-emacs@gnu.org>
@ 2008-07-14  9:56       ` Pascal J. Bourguignon
  2008-07-14 12:12         ` anhnmncb
       [not found]         ` <mailman.14698.1216038116.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 18+ messages in thread
From: Pascal J. Bourguignon @ 2008-07-14  9:56 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 14.07.2008 um 02:20 schrieb anhnmncb:
>
>> So I want to know, in this condition, if I can start an emacsclient
>> in console, then let it become server(old emacs server on Xorg
>> becomes client now), then close the emacs(old server) on Xorg,
>> restart Xorg, run emacsclient, let it become server again?

I still don't understand very well what the OP wants, but this might help.

Sometimes, I have an emacs running on host A, I connect from host B to
host A with ssh -X, and I want to open a frame of the running emacs on
a X display on host B.

To do that, I plan ahead, and have this in my ~/.emacs (on host A):


(defparameter *frame-server-job-ticket* "~/frame-emacs"
  "Path to the job-ticket file.")

(defun frame-server (&optional token-path)
  (setf token-path (or token-path *frame-server-job-ticket*))
  (when (file-exists-p token-path)
    (find-file token-path)
    (make-frame-on-display
     (delete ?\n (prog1 (buffer-string)
                   (kill-buffer (current-buffer))
                   (delete-file token-path)))
     (list (cons 'name (format "n%s" (frame-parameter nil 'name)))))))

(defun frame-server-start ()
  (interactive)
  (run-at-time nil 5 (function frame-server) nil))

(frame-server-start)



Then I only have to create the job ticket:

B> ssh -X user@A
A> echo $DISPLAY > ~/.frame-emacs

and wait for the frame to appear on B.




Nowadays, this could also be done simply with:

B> ssh -X user@A
A> emacsclient -e '(make-frame-on-display "'"$DISPLAY"'")'


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

THIS IS A 100% MATTER PRODUCT: In the unlikely event that this
merchandise should contact antimatter in any form, a catastrophic
explosion will result.


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

* Re: possible to exchange server and client?
       [not found]       ` <mailman.14692.1216028482.18990.help-gnu-emacs@gnu.org>
@ 2008-07-14 10:02         ` Pascal J. Bourguignon
  0 siblings, 0 replies; 18+ messages in thread
From: Pascal J. Bourguignon @ 2008-07-14 10:02 UTC (permalink / raw)
  To: help-gnu-emacs

anhnmncb <anhnmncb@gmail.com> writes:

> Now what I want is: Start emacs server on xorg, then run an emacsclient
> in console and make it to be a server, so the old client becomes new
> server and the old server becomes client?

Forget about this client/server terms, they're irrelevant here.


You can delete-frame the frames you don't want anymore.

But keeping an additionnal frame open is a security against accidental
exit on terminal disconnection.



You can use the following to see what display each frame is on:


(defmacro define-frame-parameter (name)
  `(defun ,(intern (format "frame-%s" name)) (&optional frame)
     (frame-parameter (or frame (selected-frame)) ',name)))

;; (dolist (p (frame-parameters)) (insert (format "(define-frame-parameter %s)\n" (car p))))

(define-frame-parameter parent-id)
(define-frame-parameter display)
(define-frame-parameter visibility)
(define-frame-parameter icon-name)
(define-frame-parameter outer-window-id)
(define-frame-parameter window-id)
(define-frame-parameter top)
(define-frame-parameter left)
(define-frame-parameter buffer-list)
(define-frame-parameter unsplittable)
(define-frame-parameter minibuffer)
(define-frame-parameter modeline)
(define-frame-parameter width)
(define-frame-parameter height)
(define-frame-parameter name)
(define-frame-parameter background-mode)
(define-frame-parameter display-type)
(define-frame-parameter horizontal-scroll-bars)
(define-frame-parameter scroll-bar-width)
(define-frame-parameter cursor-type)
(define-frame-parameter auto-lower)
(define-frame-parameter auto-raise)
(define-frame-parameter icon-type)
(define-frame-parameter wait-for-wm)
(define-frame-parameter title)
(define-frame-parameter buffer-predicate)
(define-frame-parameter tool-bar-lines)
(define-frame-parameter menu-bar-lines)
(define-frame-parameter scroll-bar-background)
(define-frame-parameter scroll-bar-foreground)
(define-frame-parameter right-fringe)
(define-frame-parameter left-fringe)
(define-frame-parameter line-spacing)
(define-frame-parameter screen-gamma)
(define-frame-parameter border-color)
(define-frame-parameter cursor-color)
(define-frame-parameter mouse-color)
(define-frame-parameter background-color)
(define-frame-parameter foreground-color)
(define-frame-parameter vertical-scroll-bars)
(define-frame-parameter internal-border-width)
(define-frame-parameter border-width)
(define-frame-parameter font)



(mapcar (lambda (frame) (list frame (frame-display frame)))
        (frame-list))

--> ((#<frame EMACS 0x94e9910> ":0.0") (#<frame MAIL 0x86109d8> ":1.0"))


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

THIS IS A 100% MATTER PRODUCT: In the unlikely event that this
merchandise should contact antimatter in any form, a catastrophic
explosion will result.


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

* Re: possible to exchange server and client?
  2008-07-14  9:40       ` anhnmncb
@ 2008-07-14 11:47         ` Peter Dyballa
  2008-07-14 12:47           ` anhnmncb
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2008-07-14 11:47 UTC (permalink / raw)
  To: anhnmncb; +Cc: help-gnu-emacs


Am 14.07.2008 um 11:40 schrieb anhnmncb:

> But there has been. See two screenshots, first is org-mode in emacs
> server, which is running in the dtach sesstion on urxvt; second is
> org-mode in emacsclient which is with the same emacs server:
>             http://paste.ubuntu.org.cn/i8055
>             http://paste.ubuntu.org.cn/i8054
> You can see, in emacsclient, the column view can't display properly,
> it's not relative to the color-theme. Emacs server works well.

It's – to me – not a question wether something works correctly or  
not. To me it looks like a difference in default-frame-alist and  
initial-frame-alist. Check these!

Make also tests with command line options like -q and -Q to see  
customised and "vanilla" behaviour.

>>>
> Now what I want is: Start emacs server on xorg, then run an  
> emacsclient
> in console and make it to be a server, so the old client becomes new
> server and the old server becomes client?


There is no frame, window, or particle of GNU Emacs that can claim:  
"Hey, *I* am the server!" (You can start it form ~/.emacs!) As long  
as in the multi-tty GNU Emacs 23.0.60 one particle of that Emacs is  
left (even when running in the background, but not when completely  
suspended, i.e., C-z without fg in terminal) which started in any  
particle the server, the server is on, running, and accessible from  
emacsclient. *Each* particle is the server and every particle could  
have been a client. It's as with hard-links. Why don't you try it?  
You dont need to quit first Emacs, just stop its server (although not  
really needed, but less complication on the command line) and launch  
another instance of GNU Emacs! There aren't so many on this list that  
did the same as you are trying to do. Therefore the lack of good  
replies.

You won't learn much English when just testing (and not writing), but  
doing (in)sane experiments will make you experienced and sure about  
what you are doing. Or trying to ...

--
Greetings

   Pete

To be is to do.
			– I. Kant
To do is to be.
			– A. Sartre
Yabba-Dabba-Doo!
			– F. Flintstone







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

* Re: possible to exchange server and client?
  2008-07-14  9:56       ` Pascal J. Bourguignon
@ 2008-07-14 12:12         ` anhnmncb
       [not found]         ` <mailman.14698.1216038116.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 18+ messages in thread
From: anhnmncb @ 2008-07-14 12:12 UTC (permalink / raw)
  To: help-gnu-emacs

hmm, I want to run emacs with server-start in Xorg, then create a frame
in console, then in the console frame, M-x server-start to make that
frame become an emacs server too, so now I can safely exit the emacs
running on xorg.

-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

* Re: possible to exchange server and client?
       [not found]         ` <mailman.14698.1216038116.18990.help-gnu-emacs@gnu.org>
@ 2008-07-14 12:47           ` Pascal J. Bourguignon
  2008-07-14 14:35             ` anhnmncb
       [not found]             ` <mailman.14703.1216046707.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 18+ messages in thread
From: Pascal J. Bourguignon @ 2008-07-14 12:47 UTC (permalink / raw)
  To: help-gnu-emacs

anhnmncb <anhnmncb@gmail.com> writes:

> hmm, I want to run emacs with server-start in Xorg, then create a frame
> in console, then in the console frame, M-x server-start to make that
> frame become an emacs server too, so now I can safely exit the emacs
> running on xorg.

This is where you are in error.  There is not one instance of emacs
per frame.  Frames are but windows open on the same emacs process.
You can make-frame and  delete-frame at will, but this is always the
same emacs process.  

In addition, server-start is totally independant of what frames emacs
has currently open.
"Running emacs with server-start in Xorg" is meaningless a sentence.

If you exit emacs from one frame, then all frames will be killed,
because there's only one emacs process.

And if you delete the last frame, emacs will also be killed, that's
why I'd advise you to always keep at least one (unused) frame open, so
you can reconnect to your emacs process when you get disconnected from
your current frame/tty.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

ATTENTION: Despite any other listing of product contents found
herein, the consumer is advised that, in actuality, this product
consists of 99.9999999999% empty space.


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

* Re: possible to exchange server and client?
  2008-07-14 11:47         ` Peter Dyballa
@ 2008-07-14 12:47           ` anhnmncb
  2008-07-14 13:58             ` Peter Dyballa
  0 siblings, 1 reply; 18+ messages in thread
From: anhnmncb @ 2008-07-14 12:47 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 14.07.2008 um 11:40 schrieb anhnmncb:
>
>> But there has been. See two screenshots, first is org-mode in emacs
>> server, which is running in the dtach sesstion on urxvt; second is
>> org-mode in emacsclient which is with the same emacs server:
>>             http://paste.ubuntu.org.cn/i8055
>>             http://paste.ubuntu.org.cn/i8054
>> You can see, in emacsclient, the column view can't display properly,
>> it's not relative to the color-theme. Emacs server works well.
>
> It's – to me – not a question wether something works correctly or not.
> To me it looks like a difference in default-frame-alist and
> initial-frame-alist. Check these!
>
> Make also tests with command line options like -q and -Q to see
> customised and "vanilla" behaviour.

hmm, -Q works, I must have to find what's wrong with my config.

>>>>
>> Now what I want is: Start emacs server on xorg, then run an
>> emacsclient
>> in console and make it to be a server, so the old client becomes new
>> server and the old server becomes client?
>
>
> There is no frame, window, or particle of GNU Emacs that can claim:
> "Hey, *I* am the server!" (You can start it form ~/.emacs!) As long
> as in the multi-tty GNU Emacs 23.0.60 one particle of that Emacs is
> left (even when running in the background, but not when completely
> suspended, i.e., C-z without fg in terminal) which started in any
> particle the server, the server is on, running, and accessible from
> emacsclient. *Each* particle is the server and every particle could
> have been a client. It's as with hard-links. Why don't you try it?
> You dont need to quit first Emacs, just stop its server (although not
> really needed, but less complication on the command line) and launch
> another instance of GNU Emacs! There aren't so many on this list that
> did the same as you are trying to do. Therefore the lack of good
> replies.
>
> You won't learn much English when just testing (and not writing), but
> doing (in)sane experiments will make you experienced and sure about
> what you are doing. Or trying to ...

What I do is, run emacs in console, then M-x server-start.
Startx, run emacsclient -c, then M-x server-start, it says:
        The current server still has clients; delete them? (y or n) 
I answser y, then the frame is killed. But I don't want to kill this
frame, I want server-start from it, so it becomes a server.

Thank you for your patient very much!

-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

* Re: possible to exchange server and client?
  2008-07-14 12:47           ` anhnmncb
@ 2008-07-14 13:58             ` Peter Dyballa
  2008-07-14 14:37               ` anhnmncb
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2008-07-14 13:58 UTC (permalink / raw)
  To: anhnmncb; +Cc: help-gnu-emacs


Am 14.07.2008 um 14:47 schrieb anhnmncb:

> What I do is, run emacs in console, then M-x server-start.
> Startx, run emacsclient -c, then M-x server-start, it says:
>         The current server still has clients; delete them? (y or n)
> I answser y, then the frame is killed. But I don't want to kill this
> frame, I want server-start from it, so it becomes a server.

Here you see that all Emacs particles launched until now belong to  
one instance of GNU Emacs, that has something like "visible threads,"  
i.e., kind of rather independent "light-weight" processes that become  
visible on the GUI/X11 surface. Every frame, window, console thing  
has the same process ID, all can share the same buffers (write a very  
unique word into *scratch* buffer and select this buffer in console  
and all frames), and all are connected to one server! So a

	(server-start)

in your init file is OK. And it's really OK, because when you launch  
another Emacs, it will start its own and now on the system second  
server, giving you the option to let emacsclient (-f, --server- 
file=FILENAME or -s, --socket-name=FILENAME) work for this or for  
that server.


One problem exists: there does not seem to exist a way to select from  
emacsclient the frame in which a file is opened ...

--
Greetings

   Pete

We are usually convinced more easily by reasons we have found  
ourselves than by those which have occurred to others.
				– Blaise Pascal







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

* Re: possible to exchange server and client?
  2008-07-14 12:47           ` Pascal J. Bourguignon
@ 2008-07-14 14:35             ` anhnmncb
  2008-07-14 15:13               ` Peter Dyballa
       [not found]             ` <mailman.14703.1216046707.18990.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 18+ messages in thread
From: anhnmncb @ 2008-07-14 14:35 UTC (permalink / raw)
  To: help-gnu-emacs

pjb@informatimago.com (Pascal J. Bourguignon) writes:

> anhnmncb <anhnmncb@gmail.com> writes:
>
>> hmm, I want to run emacs with server-start in Xorg, then create a frame
>> in console, then in the console frame, M-x server-start to make that
>> frame become an emacs server too, so now I can safely exit the emacs
>> running on xorg.
>
> This is where you are in error.  There is not one instance of emacs
> per frame.  Frames are but windows open on the same emacs process.
> You can make-frame and  delete-frame at will, but this is always the
> same emacs process.  
>
> In addition, server-start is totally independant of what frames emacs
> has currently open.
> "Running emacs with server-start in Xorg" is meaningless a sentence.
>
> If you exit emacs from one frame, then all frames will be killed,
> because there's only one emacs process.
>
> And if you delete the last frame, emacs will also be killed, that's
> why I'd advise you to always keep at least one (unused) frame open, so
> you can reconnect to your emacs process when you get disconnected from
> your current frame/tty.

Thanks for the patient and detailed explanation! Make me realise my
totally wrong concept misled you.

Let me give another try to express my need:

I start an emacs process, then make a new frame, then let this new frame
become a new emacs process, is it possible?

-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

* Re: possible to exchange server and client?
  2008-07-14 13:58             ` Peter Dyballa
@ 2008-07-14 14:37               ` anhnmncb
  0 siblings, 0 replies; 18+ messages in thread
From: anhnmncb @ 2008-07-14 14:37 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 14.07.2008 um 14:47 schrieb anhnmncb:
>
>> What I do is, run emacs in console, then M-x server-start.
>> Startx, run emacsclient -c, then M-x server-start, it says:
>>         The current server still has clients; delete them? (y or n)
>> I answser y, then the frame is killed. But I don't want to kill this
>> frame, I want server-start from it, so it becomes a server.
>
> Here you see that all Emacs particles launched until now belong to one
> instance of GNU Emacs, that has something like "visible threads,"
> i.e., kind of rather independent "light-weight" processes that become
> visible on the GUI/X11 surface. Every frame, window, console thing
> has the same process ID, all can share the same buffers (write a very
> unique word into *scratch* buffer and select this buffer in console
> and all frames), and all are connected to one server! So a
>
> 	(server-start)
>
> in your init file is OK. And it's really OK, because when you launch
> another Emacs, it will start its own and now on the system second
> server, giving you the option to let emacsclient (-f, --server- 
> file=FILENAME or -s, --socket-name=FILENAME) work for this or for that
> server.
>
>
> One problem exists: there does not seem to exist a way to select from
> emacsclient the frame in which a file is opened ...

It's totally not what I want, see my another reply to Pascal J.
Bourguignon please ;p

-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

* Re: possible to exchange server and client?
  2008-07-14 14:35             ` anhnmncb
@ 2008-07-14 15:13               ` Peter Dyballa
  2008-07-14 15:31                 ` anhnmncb
  0 siblings, 1 reply; 18+ messages in thread
From: Peter Dyballa @ 2008-07-14 15:13 UTC (permalink / raw)
  To: anhnmncb; +Cc: help-gnu-emacs


Am 14.07.2008 um 16:35 schrieb anhnmncb:

> I start an emacs process, then make a new frame, then let this new  
> frame
> become a new emacs process, is it possible?

No.

--
Greetings

   Pete

When Richard Stallman goes to the loo, he core dumps.






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

* Re: possible to exchange server and client?
  2008-07-14 15:13               ` Peter Dyballa
@ 2008-07-14 15:31                 ` anhnmncb
  0 siblings, 0 replies; 18+ messages in thread
From: anhnmncb @ 2008-07-14 15:31 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 14.07.2008 um 16:35 schrieb anhnmncb:
>
>> I start an emacs process, then make a new frame, then let this new
>> frame
>> become a new emacs process, is it possible?
>
> No.
>
hmm, I should give up :(
-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

* Re: possible to exchange server and client?
       [not found]             ` <mailman.14703.1216046707.18990.help-gnu-emacs@gnu.org>
@ 2008-07-14 16:39               ` Pascal J. Bourguignon
  2008-07-14 23:22                 ` anhnmncb
  0 siblings, 1 reply; 18+ messages in thread
From: Pascal J. Bourguignon @ 2008-07-14 16:39 UTC (permalink / raw)
  To: help-gnu-emacs

anhnmncb <anhnmncb@gmail.com> writes:

> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>
>> anhnmncb <anhnmncb@gmail.com> writes:
>>
>>> hmm, I want to run emacs with server-start in Xorg, then create a frame
>>> in console, then in the console frame, M-x server-start to make that
>>> frame become an emacs server too, so now I can safely exit the emacs
>>> running on xorg.
>>
>> This is where you are in error.  There is not one instance of emacs
>> per frame.  Frames are but windows open on the same emacs process.
>> You can make-frame and  delete-frame at will, but this is always the
>> same emacs process.  
>>
>> In addition, server-start is totally independant of what frames emacs
>> has currently open.
>> "Running emacs with server-start in Xorg" is meaningless a sentence.
>>
>> If you exit emacs from one frame, then all frames will be killed,
>> because there's only one emacs process.
>>
>> And if you delete the last frame, emacs will also be killed, that's
>> why I'd advise you to always keep at least one (unused) frame open, so
>> you can reconnect to your emacs process when you get disconnected from
>> your current frame/tty.
>
> Thanks for the patient and detailed explanation! Make me realise my
> totally wrong concept misled you.
>
> Let me give another try to express my need:
>
> I start an emacs process, then make a new frame, then let this new frame
> become a new emacs process, is it possible?

No, this is not possible.


There is one thing that would be possible, at the X11 level, but it
wouldn't be too interesting.  In X11, you can open a window inside
another window.  Some programs take a -windowid option to let you
choose which window they should be hosted in.

To see what I mean, try this:

export DISPLAY=:0.0
emacs & 
xv -windowid $(xwininfo -int  2> /dev/null |awk '/Window id/{print $4}') some-picture.jpg

and then, click on the emacs frame.  xv will display the picture
inside the emacs frame.

So we could imagine a patched emacs that would take a -windowid
option, and then you could launch a new emacs process that would use
an existing frame.  I don't know what X would do if the old process
was killed then, I guess it would kill the surrounding frame, since it
would still belong to the original process, along with the embedded
frame of the second process.


Perhaps the following solution would match your need.  Instead of
opening the frames directly in the native X server, you could run them
in a Xnest server.  Then you could launch another emacs process, open
a frame in the same Xnest server.  Both emacs frames would be
displayed inside the same Xnest window, but as independent Xnest
windows.  The next step would be to use xmove or vnc to move X windows
from one display to another, and manage sessions:

http://www.hermann-uwe.de/blog/how-to-hijack-an-already-running-x11-application-via-ssh-x

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

THIS IS A 100% MATTER PRODUCT: In the unlikely event that this
merchandise should contact antimatter in any form, a catastrophic
explosion will result.


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

* Re: possible to exchange server and client?
  2008-07-14 16:39               ` Pascal J. Bourguignon
@ 2008-07-14 23:22                 ` anhnmncb
  0 siblings, 0 replies; 18+ messages in thread
From: anhnmncb @ 2008-07-14 23:22 UTC (permalink / raw)
  To: help-gnu-emacs

pjb@informatimago.com (Pascal J. Bourguignon) writes:

> anhnmncb <anhnmncb@gmail.com> writes:
>
>> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>>
>>> anhnmncb <anhnmncb@gmail.com> writes:
>>
>> Thanks for the patient and detailed explanation! Make me realise my
>> totally wrong concept misled you.
>>
>> Let me give another try to express my need:
>>
>> I start an emacs process, then make a new frame, then let this new frame
>> become a new emacs process, is it possible?
>
> No, this is not possible.
>
>
> There is one thing that would be possible, at the X11 level, but it
> wouldn't be too interesting.  In X11, you can open a window inside
> another window.  Some programs take a -windowid option to let you
> choose which window they should be hosted in.
>
> To see what I mean, try this:
>
> export DISPLAY=:0.0
> emacs & 
> xv -windowid $(xwininfo -int  2> /dev/null |awk '/Window id/{print $4}') some-picture.jpg
>
> and then, click on the emacs frame.  xv will display the picture
> inside the emacs frame.
>
> So we could imagine a patched emacs that would take a -windowid
> option, and then you could launch a new emacs process that would use
> an existing frame.  I don't know what X would do if the old process
> was killed then, I guess it would kill the surrounding frame, since it
> would still belong to the original process, along with the embedded
> frame of the second process.
>
>
> Perhaps the following solution would match your need.  Instead of
> opening the frames directly in the native X server, you could run them
> in a Xnest server.  Then you could launch another emacs process, open
> a frame in the same Xnest server.  Both emacs frames would be
> displayed inside the same Xnest window, but as independent Xnest
> windows.  The next step would be to use xmove or vnc to move X windows
> from one display to another, and manage sessions:
>
> http://www.hermann-uwe.de/blog/how-to-hijack-an-already-running-x11-application-via-ssh-x

This one looks cool, thanks :)
-- 
Regards,

  anhnmncb
 gpg key: 44A31344





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

end of thread, other threads:[~2008-07-14 23:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-13  1:10 possible to exchange server and client? anhnmncb
2008-07-13 20:13 ` Peter Dyballa
2008-07-14  0:20   ` anhnmncb
2008-07-14  7:48     ` Peter Dyballa
2008-07-14  9:40       ` anhnmncb
2008-07-14 11:47         ` Peter Dyballa
2008-07-14 12:47           ` anhnmncb
2008-07-14 13:58             ` Peter Dyballa
2008-07-14 14:37               ` anhnmncb
     [not found]       ` <mailman.14692.1216028482.18990.help-gnu-emacs@gnu.org>
2008-07-14 10:02         ` Pascal J. Bourguignon
     [not found]     ` <mailman.14687.1216021747.18990.help-gnu-emacs@gnu.org>
2008-07-14  9:56       ` Pascal J. Bourguignon
2008-07-14 12:12         ` anhnmncb
     [not found]         ` <mailman.14698.1216038116.18990.help-gnu-emacs@gnu.org>
2008-07-14 12:47           ` Pascal J. Bourguignon
2008-07-14 14:35             ` anhnmncb
2008-07-14 15:13               ` Peter Dyballa
2008-07-14 15:31                 ` anhnmncb
     [not found]             ` <mailman.14703.1216046707.18990.help-gnu-emacs@gnu.org>
2008-07-14 16:39               ` Pascal J. Bourguignon
2008-07-14 23:22                 ` anhnmncb

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.