all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* gnu/emacs client --create-frame somehow?
@ 2003-11-27 16:28 Thorsten Bonow
  2003-11-27 22:23 ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Thorsten Bonow @ 2003-11-27 16:28 UTC (permalink / raw)



Hi,

I would like to use gnuclient or the new emacsclient out of CVS so that the
decision if a new frame is created is up to me when calling the client
command.

I know about "gnuserv-frame" to decide about frame creation with gnuclient or
adding a hook which calls "make-frame" to "server-visit-hook" for emacsclient,
but than the behavior is fixed for all calls to the client.

What I'm looking for is some way of simulating a --create-frame option and
then calling

        emacsclient/gnuclient --create-frame FILE

only if I want a new frame. I'm not up to fixing (gnu)server.el to implement
such an option, my first crude attempt was to write a wrapper script which
calls the client two times: First to set e.g. gnuserv-frame to the desired
value and then a second time to execute the actual command.

Thanks for any help ...

Toto

-- 
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow

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

* Re: gnu/emacs client --create-frame somehow?
  2003-11-27 16:28 gnu/emacs client --create-frame somehow? Thorsten Bonow
@ 2003-11-27 22:23 ` Stefan Monnier
  2003-11-28  0:47   ` Ian Zimmerman
  2003-12-01 11:03   ` Thorsten Bonow
  0 siblings, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2003-11-27 22:23 UTC (permalink / raw)


> I would like to use gnuclient or the new emacsclient out of CVS so that the
> decision if a new frame is created is up to me when calling the client
> command.

> I know about "gnuserv-frame" to decide about frame creation with gnuclient
> or adding a hook which calls "make-frame" to "server-visit-hook" for
> emacsclient, but than the behavior is fixed for all calls to the client.

(setq server-window 'pop-to-buffer)

> What I'm looking for is some way of simulating a --create-frame option and
> then calling
>         emacsclient/gnuclient --create-frame FILE

Since server.el and emacsclient.c do not offer any way to add new
options like --create-frame, your best bet is probably something like

  emacsclient --eval '(find-file-other-frame "FILE")'

But maybe you have a point that it should be possible to add new
options, kind of like what is done with `command-switch-alist'.


        Stefan

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

* Re: gnu/emacs client --create-frame somehow?
  2003-11-27 22:23 ` Stefan Monnier
@ 2003-11-28  0:47   ` Ian Zimmerman
  2003-11-28  9:01     ` Thorsten Bonow
  2003-12-01 11:03   ` Thorsten Bonow
  1 sibling, 1 reply; 11+ messages in thread
From: Ian Zimmerman @ 2003-11-28  0:47 UTC (permalink / raw)



Stefan>   emacsclient --eval '(find-file-other-frame "FILE")'

Does the --eval option actually exist in CVS or is this entirely hypothetical?

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

* Re: gnu/emacs client --create-frame somehow?
  2003-11-28  0:47   ` Ian Zimmerman
@ 2003-11-28  9:01     ` Thorsten Bonow
  0 siblings, 0 replies; 11+ messages in thread
From: Thorsten Bonow @ 2003-11-28  9:01 UTC (permalink / raw)


> Does the --eval option actually exist in CVS or is this entirely hypothetical?

It exists in the CVS version. That's what --help outputs:

Usage: /usr/local/src/emacs-21.3.5_cvs/emacs_build/lib-src/emacsclient [OPTIONS] FILE...
Tell the Emacs server to visit the specified files.
Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.

The following OPTIONS are accepted:
-V, --version           Just print a version info and return
-H, --help              Print this usage information message
-n, --no-wait           Don't wait for the server to return
-e, --eval              Evaluate the FILE arguments as ELisp expressions
-d, --display=DISPLAY   Visit the file in the given display
-s, --socket-name=FILENAME
                        Set the filename of the UNIX socket for communication
-a, --alternate-editor=EDITOR
                        Editor to fallback to if the server is not running

-- 
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow

Daydreaming while smoking cigars can be a fire hazard. It can be as
dangerous as drugs and booze unless you know what you're doing. If you
know what you're doing, it can be as safe as walking down the street.

Friedman, Kinky (1993), When the cat's away. New York (Wings Books),
418

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

* Re: gnu/emacs client --create-frame somehow?
  2003-11-27 22:23 ` Stefan Monnier
  2003-11-28  0:47   ` Ian Zimmerman
@ 2003-12-01 11:03   ` Thorsten Bonow
  2003-12-01 19:39     ` Stefan Monnier
  2003-12-01 20:19     ` Kevin Rodgers
  1 sibling, 2 replies; 11+ messages in thread
From: Thorsten Bonow @ 2003-12-01 11:03 UTC (permalink / raw)


>>>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

    >> What I'm looking for is some way of simulating a --create-frame
    >> option and then calling emacsclient/gnuclient --create-frame
    >> FILE

    Stefan> Since server.el and emacsclient.c do not offer any way to
    Stefan> add new options like --create-frame, your best bet is
    Stefan> probably something like

    Stefan>   emacsclient --eval '(find-file-other-frame "FILE")'

    Yes, this opens up a new frame, but then I am loosing the
    [+line-number] option of gnu/emacsclient. My problem started when
    writing with LaTeX in Emacs, previewing with xdvi: With the
    inverse search feature, switching between a line in the document
    and the preview of this part of your document is possible. So I
    wouldn't want to loose the line-number information or open up a new
    frame every time I switch. But in other cases---say when clicking
    on a "mailto:"-tag in my web-browser, I want a new frame for
    composing an email.

    Stefan> But maybe you have a point that it should be possible to
    Stefan> add new options, kind of like what is done with
    Stefan> `command-switch-alist'.

    After some testing I think gnuclient's option to set "gnuserv-frame"
    to "gnuserv-visible-frame-function", which is opening a new frame
    only if there isn't one already opened on your (virtual) screen
    and is using the visible frame otherwise, is my preferred
    solution. Alas, this is not working even with emacsclient from CVS.

    On the other hand, I think emacsclient's approach of taking either
    file and line number arguments *or* evaluating lisp expressions is
    cleaner than gnuclients -f and -e options for executing a function
    or evaluating lisp together with file arguments---you never now
    what is done first.

    So I wouldn't add options to emacsclient, but having convenience
    lisp functions for the problems above would be nice.

    Stefan>         Stefan

    Toto

-- 
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow

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

* Re: gnu/emacs client --create-frame somehow?
  2003-12-01 11:03   ` Thorsten Bonow
@ 2003-12-01 19:39     ` Stefan Monnier
  2003-12-02 22:10       ` Thorsten Bonow
  2003-12-01 20:19     ` Kevin Rodgers
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2003-12-01 19:39 UTC (permalink / raw)


>     After some testing I think gnuclient's option to set "gnuserv-frame"
>     to "gnuserv-visible-frame-function", which is opening a new frame
>     only if there isn't one already opened on your (virtual) screen
>     and is using the visible frame otherwise, is my preferred
>     solution. Alas, this is not working even with emacsclient from CVS.

Huh ?  Setting server-window to `pop-to-buffer' does exactly that
(provided you configure pop-to-buffer properly of course: by default it
does not create new frames).


        Stefan

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

* Re: gnu/emacs client --create-frame somehow?
  2003-12-01 11:03   ` Thorsten Bonow
  2003-12-01 19:39     ` Stefan Monnier
@ 2003-12-01 20:19     ` Kevin Rodgers
  1 sibling, 0 replies; 11+ messages in thread
From: Kevin Rodgers @ 2003-12-01 20:19 UTC (permalink / raw)


Thorsten Bonow wrote:

>>>>>>"Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>>>>>
> 
>     >> What I'm looking for is some way of simulating a --create-frame
>     >> option and then calling emacsclient/gnuclient --create-frame
>     >> FILE
> 
>     Stefan> Since server.el and emacsclient.c do not offer any way to
>     Stefan> add new options like --create-frame, your best bet is
>     Stefan> probably something like
> 
>     Stefan>   emacsclient --eval '(find-file-other-frame "FILE")'
> 
>     Yes, this opens up a new frame, but then I am loosing the
>     [+line-number] option of gnu/emacsclient.


emacsclient --eval '(progn (find-file-other-frame "FILE") (goto-line LINE))'

-- 
Kevin Rodgers

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

* Re: gnu/emacs client --create-frame somehow?
  2003-12-01 19:39     ` Stefan Monnier
@ 2003-12-02 22:10       ` Thorsten Bonow
  2003-12-02 23:44         ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Thorsten Bonow @ 2003-12-02 22:10 UTC (permalink / raw)


>>>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

    >> After some testing I think gnuclient's option to set
    >> "gnuserv-frame" to "gnuserv-visible-frame-function", which is
    >> opening a new frame only if there isn't one already opened on
    >> your (virtual) screen and is using the visible frame otherwise,
    >> is my preferred solution. Alas, this is not working even with
    >> emacsclient from CVS.

    Stefan> Huh ?  Setting server-window to `pop-to-buffer' does
    Stefan> exactly that (provided you configure pop-to-buffer
    Stefan> properly of course: by default it does not create new
    Stefan> frames).

    Sorry, now I'm utterly confused. The way I understood the manual
    is, that pop-to-buffer is buffer oriented, meaning that even if I
    set pop-up-frames to non-nil, a new frame is only opened if the
    buffer is not displayed in another frame. This solves my
    LaTeX-Xdvi problem, but doesn't work if I want to force
    frame-creation.

    gnuserv-visible-frame-function on the other hand is frame
    oriented. If there is no frame on my virtual screen, one pops up,
    even if the file is already displayed in another buffer.
    
    So with gnuclient, I can solve my LaTeX-Xdvi problem *and* if I
    define 

    (defun my-xemacs-info-other-frame ()
           "my-xemacs-info-other-frame"
           (interactive)
           (let (gnuserv-frame)
           (info)))

    I can call gnuclient -eval "(my-xemacs-info-other-frame)" and a
    frame pops up even if *INFO* is displayed in another frame.

    (defun my-info-other-frame ()
      "my-info-other-frame"
      (interactive)
      (let ((pop-up-frames t))
      (info-other-window))) 

    only works with emacsclient if *INFO* isn't displayed somewhere
    else.

    Sorry about pestering you with this. But I hope to get this right
    for my emacsclient/gnuclient wrapper script.

    Stefan>         Stefan

    Toto

-- 
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow

Now I have a cat. Well, that's not quite accurate. A cat and I have
each other.

Friedman, Kinky (1993), When the cat's away. New York (Wings Books),
421

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

* Re: gnu/emacs client --create-frame somehow?
  2003-12-02 22:10       ` Thorsten Bonow
@ 2003-12-02 23:44         ` Stefan Monnier
  2003-12-03 12:02           ` Thorsten Bonow
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2003-12-02 23:44 UTC (permalink / raw)


>     gnuserv-visible-frame-function on the other hand is frame
>     oriented. If there is no frame on my virtual screen, one pops up,
>     even if the file is already displayed in another buffer.

You mean it will reuse a pre-existing window and change the buffer
displayed in that window ?
In that case indeed, pop-to-buffer might not be what you want, but I don't
understand when a frame is going to be opened, then, unless you're thinking
of a multiple-X-server situation, in which case the --display argument of
emacsclient should be what you want (although it's only be lightly tested).

Or do you mean that if the buffer is already displayed in a window but
on another display, then pop-to-buffer fails to open a new window/frame
on the right display ?  That might be: there are many such bugs in
a multiple-display situation.  Please report such problems to gnu.emacs.bug
via M-x report-emacs-bug.
    
>     (defun my-xemacs-info-other-frame ()
>            "my-xemacs-info-other-frame"
>            (interactive)
>            (let (gnuserv-frame)
>            (info)))

>     I can call gnuclient -eval "(my-xemacs-info-other-frame)" and a
>     frame pops up even if *INFO* is displayed in another frame.

But I can't easily check what the above code does: are you trying to force
the creation of a new frame that shows the same *info* buffer a second time
on the same display or is it on a separate display ?


        Stefan

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

* Re: gnu/emacs client --create-frame somehow?
  2003-12-02 23:44         ` Stefan Monnier
@ 2003-12-03 12:02           ` Thorsten Bonow
  2003-12-03 16:10             ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Thorsten Bonow @ 2003-12-03 12:02 UTC (permalink / raw)


>>>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

    >> gnuserv-visible-frame-function on the other hand is frame
    >> oriented. If there is no frame on my virtual screen, one pops
    >> up, even if the file is already displayed in another buffer.

    Stefan> You mean it will reuse a pre-existing window and change
    Stefan> the buffer displayed in that window ?  In that case
    Stefan> indeed, pop-to-buffer might not be what you want, but I
    Stefan> don't understand when a frame is going to be opened, then,
    Stefan> unless you're thinking of a multiple-X-server situation,
    Stefan> in which case the --display argument of emacsclient should
    Stefan> be what you want (although it's only be lightly tested).

    No, I only mean a GNU/Linux box with a windowmanager which gives
    me multiple virtual desktops (LarsWM, 4 virtual desktops). 

    Stefan> Or do you mean that if the buffer is already displayed in
    Stefan> a window but on another display, then pop-to-buffer fails
    Stefan> to open a new window/frame on the right display ?  That
    Stefan> might be: there are many such bugs in a multiple-display
    Stefan> situation.  Please report such problems to gnu.emacs.bug
    Stefan> via M-x report-emacs-bug.
    
    No, I think pop-to-buffer/pop-up-frame is working as advertised,
    it's just not what I want---or I haven't figured out how to
    configure it right for my needs.

    >> (defun my-xemacs-info-other-frame ()
    >> "my-xemacs-info-other-frame" (interactive) (let (gnuserv-frame)
    >> (info)))

    >> I can call gnuclient -eval "(my-xemacs-info-other-frame)" and a
    >> frame pops up even if *INFO* is displayed in another frame.

    Stefan> But I can't easily check what the above code does: are you
    Stefan> trying to force the creation of a new frame that shows the
    Stefan> same *info* buffer a second time on the same display or is
    Stefan> it on a separate display ?
    
    On XEmacs, this function forces the creation of a new frame that
    shows the *info* buffer on the virtual desktop I am looking
    at---and yes, if another frame somewhere else is displaying *info*
    too, I end up having two frames displaying *info*.

    Stefan>         Stefan

    Again, thanks for taking your time to figure out what I mean.

    Toto

-- 
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow

HERE  is  Edward  Bear, coming downstairs
now, bump, bump, bump, on the back of his
head, behind Christopher Robin. It is, as
far  as he knows, the  only way of coming
downstairs,  but sometimes  he feels that
there  is  another way,  if only he could
stop  bumping  for a  moment and think of
it.  And then he feels that perhaps there
isn't.  Anyhow, here he is at the bottom,
and   ready  to  be  introduced  to  you.
Winnie-the-Pooh.

A.A. Milne: Winnie-the-Pooh

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

* Re: gnu/emacs client --create-frame somehow?
  2003-12-03 12:02           ` Thorsten Bonow
@ 2003-12-03 16:10             ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2003-12-03 16:10 UTC (permalink / raw)


>     No, I only mean a GNU/Linux box with a windowmanager which gives
>     me multiple virtual desktops (LarsWM, 4 virtual desktops). 

Well, I don't know of any standard way for the window-manager to tell
clients about the existence of such virtual workspaces, so from
Emacs's point of view, those don't exist.

My window-manager (ctwm) automatically brings a window into the current
workspace if an application asks for its window to be de-iconified.

This means that for me pop-to-buffer in your example will cause the *info*
frame to be brought into the current workspace.

>     No, I think pop-to-buffer/pop-up-frame is working as advertised,
>     it's just not what I want---or I haven't figured out how to
>     configure it right for my needs.

Maybe you can get your window-manager to do its part.

>     On XEmacs, this function forces the creation of a new frame that
>     shows the *info* buffer on the virtual desktop I am looking
>     at---and yes, if another frame somewhere else is displaying *info*
>     too, I end up having two frames displaying *info*.

Ah, so you're working around a limitation of your window manager (or maybe
a limitation in Emacs w.r.t understanding what your window-manager does) by
forcing the creation of a new frame no-matter-what.
Of course, you can do that as well with emacsclient.
E.g. something like (100% guaranteed non-tested code):

   emacsclient --eval '(progn (select-frame (make-frame)) (info))'


-- Stefan

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

end of thread, other threads:[~2003-12-03 16:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-27 16:28 gnu/emacs client --create-frame somehow? Thorsten Bonow
2003-11-27 22:23 ` Stefan Monnier
2003-11-28  0:47   ` Ian Zimmerman
2003-11-28  9:01     ` Thorsten Bonow
2003-12-01 11:03   ` Thorsten Bonow
2003-12-01 19:39     ` Stefan Monnier
2003-12-02 22:10       ` Thorsten Bonow
2003-12-02 23:44         ` Stefan Monnier
2003-12-03 12:02           ` Thorsten Bonow
2003-12-03 16:10             ` Stefan Monnier
2003-12-01 20:19     ` Kevin Rodgers

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.