all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
@ 2007-07-18 22:31 Edward
  2007-07-19  7:24 ` Andrea Vettorello
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Edward @ 2007-07-18 22:31 UTC (permalink / raw)
  To: help-gnu-emacs


I recently realized you can send Elisp commands to an Emacs session
(with a running server) using the following shell command:

emacsclient -n -e "(iconify-or-deiconify-frame)"

It's nice to be able to iconify or deiconify Emacs from the command
line by setting the above command to an easy-to-type alias,  but I'd
really like to do something a little more useful.  I want to bring
Emacs to my current FVWM2 desktop and then send it back to its
original desktop when I'm done,  something like (thisdesktop-or-
thatdesktop-frame).  Anyone know a nice,   elegant way to accomplish
this?  Thanks in advance.

Edward

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-18 22:31 Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop? Edward
@ 2007-07-19  7:24 ` Andrea Vettorello
  2007-07-19  7:45 ` Anselm Helbig
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Andrea Vettorello @ 2007-07-19  7:24 UTC (permalink / raw)
  To: help-gnu-emacs

On 7/19/07, Edward <edward.dodge@gmail.com> wrote:

[...]

> really like to do something a little more useful.  I want to bring
> Emacs to my current FVWM2 desktop and then send it back to its
> original desktop when I'm done,  something like (thisdesktop-or-
> thatdesktop-frame).  Anyone know a nice,   elegant way to accomplish
> this?  Thanks in advance.

If you can't control your WM from within Emacs (/me looking at Sawfish
^_^), you can try with http://www.sweb.cz/tripie/utils/wmctrl/, it's a
command line utility that permits to interact with EWMH compatible
window managers, but in the home page FVWM2 isn't mentioned tho.

Another option is to use an X feature (but i don't recall the name
right now), that can simulate user input event on clients, yeah i
know, not so useful...


-- 
Andrea

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-18 22:31 Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop? Edward
  2007-07-19  7:24 ` Andrea Vettorello
@ 2007-07-19  7:45 ` Anselm Helbig
  2007-07-19  8:41 ` Floyd L. Davidson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Anselm Helbig @ 2007-07-19  7:45 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, 

> I recently realized you can send Elisp commands to an Emacs session
> (with a running server) using the following shell command:
> 
> emacsclient -n -e "(iconify-or-deiconify-frame)"
> 
> It's nice to be able to iconify or deiconify Emacs from the command
> line by setting the above command to an easy-to-type alias,  but I'd
> really like to do something a little more useful.  I want to bring
> Emacs to my current FVWM2 desktop and then send it back to its
> original desktop when I'm done,  something like (thisdesktop-or-
> thatdesktop-frame).  Anyone know a nice,   elegant way to accomplish
> this?  Thanks in advance.

AFAIK workspaces/desktops are a window manager specific thing, so
there is no general solution to this. For FVWM, there's a program
called FvwmConsole which looks like it could do the trick - you could
define some functions to change the desktop which call FvwmConsole and
issue the appropriate commands to FVWM and then add them to the right
hooks, or call them with some longish invocation to emacsclient, for
which you will probably write a shell function. 8-)

I don't use Fvwm myself, but if you need some help with the elisp,
post again. 

Regards, 

Anselm

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-18 22:31 Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop? Edward
  2007-07-19  7:24 ` Andrea Vettorello
  2007-07-19  7:45 ` Anselm Helbig
@ 2007-07-19  8:41 ` Floyd L. Davidson
  2007-07-19  9:02   ` Tassilo Horn
  2007-07-19 17:07 ` Xiao-Yong Jin
  2007-07-20  4:29 ` Tim X
  4 siblings, 1 reply; 15+ messages in thread
From: Floyd L. Davidson @ 2007-07-19  8:41 UTC (permalink / raw)
  To: help-gnu-emacs

Edward <edward.dodge@gmail.com> wrote:
>I recently realized you can send Elisp commands to an Emacs session
>(with a running server) using the following shell command:
>
>emacsclient -n -e "(iconify-or-deiconify-frame)"
>
>It's nice to be able to iconify or deiconify Emacs from the command
>line by setting the above command to an easy-to-type alias,  but I'd
>really like to do something a little more useful.  I want to bring
>Emacs to my current FVWM2 desktop and then send it back to its
>original desktop when I'm done,  something like (thisdesktop-or-
>thatdesktop-frame).  Anyone know a nice,   elegant way to accomplish
>this?  Thanks in advance.

Do you really want to do that?

Why not simply run the server unmapped (or iconified),
and configure the clients to run with their own X
window.  Each will have access to all buffers, they can
all be left running, and you have an editor everywhere
and anywhere that you need it.

(I do that with XEmacs, and I'm sure that Emacs works
exactly the same way.  I can't quite imagine moving one
editor window from desktop to desktop, if for no other
reason than it would always have the wrong buffer
displayed!)

-- 
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)              floyd@apaflo.com

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-19  8:41 ` Floyd L. Davidson
@ 2007-07-19  9:02   ` Tassilo Horn
  2007-07-19 18:17     ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Tassilo Horn @ 2007-07-19  9:02 UTC (permalink / raw)
  To: help-gnu-emacs

floyd@apaflo.com (Floyd L. Davidson) writes:

Hi,

> Why not simply run the server unmapped (or iconified), and configure
> the clients to run with their own X window.  Each will have access to
> all buffers, they can all be left running, and you have an editor
> everywhere and anywhere that you need it. (I do that with XEmacs, and
> I'm sure that Emacs works exactly the same way.  I can't quite imagine
> moving one editor window from desktop to desktop, if for no other
> reason than it would always have the wrong buffer displayed!)

That's what gnuserv does, but emacsclient won't open a new frame. But
there's a port of gnuserv to GNU emacs that you can use until multi-tty
support gets merged into GNU emacs. That will support all this and much
more.

Bye,
Tassilo
-- 
No person,  no idea, and no  religion deserves to be  illegal to insult,
not even the Church of Emacs. (Richard M. Stallman)

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-18 22:31 Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop? Edward
                   ` (2 preceding siblings ...)
  2007-07-19  8:41 ` Floyd L. Davidson
@ 2007-07-19 17:07 ` Xiao-Yong Jin
  2007-07-20  4:29 ` Tim X
  4 siblings, 0 replies; 15+ messages in thread
From: Xiao-Yong Jin @ 2007-07-19 17:07 UTC (permalink / raw)
  To: Edward; +Cc: help-gnu-emacs

Edward <edward.dodge@gmail.com> writes:

> I recently realized you can send Elisp commands to an Emacs session
> (with a running server) using the following shell command:
>
> emacsclient -n -e "(iconify-or-deiconify-frame)"
>
> It's nice to be able to iconify or deiconify Emacs from the command
> line by setting the above command to an easy-to-type alias,  but I'd
> really like to do something a little more useful.  I want to bring
> Emacs to my current FVWM2 desktop and then send it back to its
> original desktop when I'm done,  something like (thisdesktop-or-
> thatdesktop-frame).  Anyone know a nice,   elegant way to accomplish
> this?  Thanks in advance.
>

I'm not sure I understand your term `desktop' very well.
However, if you mean different DISPLAY, emacsclient is
capable to open a new frame on new display, AFAIK.
Something like this will do,

emacsclient -e "(make-frame-on-display \"$DISPLAY\")"

But if you mean the Desktop in FVWM2, you might just use the
command provided by our powerful window manager.  Bind

All ("emacs") MoveToDesk

or similar to some keys you like in FVWM2, and you can feel
it.

>
> Edward
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
>

Cheers,
Xiao-Yong

-- 
    c/*    __o/*
    <\     * (__
    */\      <

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-19  9:02   ` Tassilo Horn
@ 2007-07-19 18:17     ` Stefan Monnier
  2007-07-19 19:01       ` Tassilo Horn
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2007-07-19 18:17 UTC (permalink / raw)
  To: help-gnu-emacs

> That's what gnuserv does, but emacsclient won't open a new frame.

By default it doesn't, indeed, but it can be asked to do it.


        Stefan

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-19 18:17     ` Stefan Monnier
@ 2007-07-19 19:01       ` Tassilo Horn
  2007-07-19 20:45         ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Tassilo Horn @ 2007-07-19 19:01 UTC (permalink / raw)
  To: help-gnu-emacs

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

>> That's what gnuserv does, but emacsclient won't open a new frame.
>
> By default it doesn't, indeed, but it can be asked to do it.

How? Of course I could do

    emacsclient -e '(make-frame)'

but then I cannot give a file name, too.

Bye,
Tassilo
-- 
Windows: So easy to admin, even a worm can do it.

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-19 19:01       ` Tassilo Horn
@ 2007-07-19 20:45         ` Stefan Monnier
  2007-07-20  8:07           ` Tassilo Horn
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2007-07-19 20:45 UTC (permalink / raw)
  To: help-gnu-emacs

>>> That's what gnuserv does, but emacsclient won't open a new frame.
>> 
>> By default it doesn't, indeed, but it can be asked to do it.

> How? Of course I could do

>     emacsclient -e '(make-frame)'

> but then I cannot give a file name, too.

Check out the various configuration variables.
C-h v server-*
IIRC you can do something like

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

and if you use pop-up-frames, then it should just work.  If you don't use
pop-up-frames, then maybe

   (setq server-window
         (lambda (buf)
           (let ((pop-up-frames t))
             (pop-to-buffer buf))))


-- Stefan

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-18 22:31 Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop? Edward
                   ` (3 preceding siblings ...)
  2007-07-19 17:07 ` Xiao-Yong Jin
@ 2007-07-20  4:29 ` Tim X
  4 siblings, 0 replies; 15+ messages in thread
From: Tim X @ 2007-07-20  4:29 UTC (permalink / raw)
  To: help-gnu-emacs

Edward <edward.dodge@gmail.com> writes:

> I recently realized you can send Elisp commands to an Emacs session
> (with a running server) using the following shell command:
>
> emacsclient -n -e "(iconify-or-deiconify-frame)"
>
> It's nice to be able to iconify or deiconify Emacs from the command
> line by setting the above command to an easy-to-type alias,  but I'd
> really like to do something a little more useful.  I want to bring
> Emacs to my current FVWM2 desktop and then send it back to its
> original desktop when I'm done,  something like (thisdesktop-or-
> thatdesktop-frame).  Anyone know a nice,   elegant way to accomplish
> this?  Thanks in advance.
>

What you want to do is really a function of the window manager rather than
emacs. I'm not familiar with fvm2, but I would be checking its docs and
possibly asking on a specific fvwm2 forum. 

regards,

Tim

P.S. Note that it is possible to control your window manager from within emacs.
for example, sawfish makes it fairly easy for you to call custom window manager
code (written in 'rep') to manipulate the window manager. However, if what you
want to do is send a command to bring emacs to the current frame/workspace and
then issue another command to warp it back to where it was, its the window
manager you need to interact with, not emacs.

-- 
tcross (at) rapttech dot com dot au

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-19 20:45         ` Stefan Monnier
@ 2007-07-20  8:07           ` Tassilo Horn
  2007-07-21  4:29             ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Tassilo Horn @ 2007-07-20  8:07 UTC (permalink / raw)
  To: help-gnu-emacs

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

Hi Stefan,

>    (setq server-window
>          (lambda (buf)
>            (let ((pop-up-frames t))
>              (pop-to-buffer buf))))

I tried that, but it didn't work. The buffer is still opened in the old
frame.

Then I've set pop-up-frames to t globally and server-window to
pop-to-buffer, but still it doesn't work. If I eval

  (progn
    (setq pop-up-frames t)
    (display-buffer "*Group*"))

The *Group* buffer will be displayed in a new window, but no new frame
will be created.

I think this is a bug, isn't it? Should I write a bug report with
`report-emacs-bug'?

I use a 2 hours old CVS checkout (trunk).

Bye,
Tassilo
-- 
"Sweating bullets" is literally what happens when Chuck Norris gets too hot. 

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-20  8:07           ` Tassilo Horn
@ 2007-07-21  4:29             ` Stefan Monnier
  2007-07-21  7:55               ` Tassilo Horn
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2007-07-21  4:29 UTC (permalink / raw)
  To: help-gnu-emacs

> If I eval

>   (progn
>     (setq pop-up-frames t)
>     (display-buffer "*Group*"))

> The *Group* buffer will be displayed in a new window, but no new frame
> will be created.

That's not what I see with the trunk of Emacs-CVS startd with "emacs -Q", so
either it's been fixed, or it depends on some config of yours.  Try it with
"emacs -Q" first.

> I think this is a bug, isn't it?

I think so, yes.

> Should I write a bug report with `report-emacs-bug'?

Yes, starting from "emacs -Q" with as recent an Emacs as you can.


        Stefan

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-21  4:29             ` Stefan Monnier
@ 2007-07-21  7:55               ` Tassilo Horn
  2007-07-22  3:33                 ` Stefan Monnier
  0 siblings, 1 reply; 15+ messages in thread
From: Tassilo Horn @ 2007-07-21  7:55 UTC (permalink / raw)
  To: help-gnu-emacs

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

>> If I eval
>
>>   (progn
>>     (setq pop-up-frames t)
>>     (display-buffer "*Group*"))
>
>> The *Group* buffer will be displayed in a new window, but no new frame
>> will be created.
>
> That's not what I see with the trunk of Emacs-CVS startd with "emacs
> -Q", so either it's been fixed, or it depends on some config of yours.

The error is on my side. :-)

I use my own `display-buffer-function' to have emacs split windows
horizontally by default. And, of course, I forgot to handle the
pop-up-frames case. Now I tried adding it, but I don't get it right. How
do I create a new frame and display a given buffer in it?

--8<---------------cut here---------------start------------->8---
(defun th-display-buffer (buffer force-other-window)
  (if pop-up-frames
      ;; This does not work... :-(
      (make-frame `((buffer-list . (,buffer))))
    (or (get-buffer-window buffer)
        (if (one-window-p)
            (let ((new-win (if (> (window-width) (if window-system 165 153))
                               (split-window-horizontally)
                             (split-window-vertically))))
              (set-window-buffer new-win buffer)
              new-win)
          (let ((new-win (get-lru-window)))
            (set-window-buffer new-win buffer)
            new-win)))))

(setq display-buffer-function 'th-display-buffer)
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-21  7:55               ` Tassilo Horn
@ 2007-07-22  3:33                 ` Stefan Monnier
  2007-07-22 12:29                   ` Tassilo Horn
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2007-07-22  3:33 UTC (permalink / raw)
  To: help-gnu-emacs

>>> If I eval
>> 
>>> (progn
>>> (setq pop-up-frames t)
>>> (display-buffer "*Group*"))
>> 
>>> The *Group* buffer will be displayed in a new window, but no new frame
>>> will be created.
>> 
>> That's not what I see with the trunk of Emacs-CVS startd with "emacs
>> -Q", so either it's been fixed, or it depends on some config of yours.

> The error is on my side. :-)

> I use my own `display-buffer-function' to have emacs split windows
> horizontally by default. And, of course, I forgot to handle the
> pop-up-frames case. Now I tried adding it, but I don't get it right. How
> do I create a new frame and display a given buffer in it?

You might try:

  (let ((display-buffer-function nil)
        (pop-up-frames t))
    (display-buffer <buffer>))


-- Stefan

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

* Re: Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop?
  2007-07-22  3:33                 ` Stefan Monnier
@ 2007-07-22 12:29                   ` Tassilo Horn
  0 siblings, 0 replies; 15+ messages in thread
From: Tassilo Horn @ 2007-07-22 12:29 UTC (permalink / raw)
  To: help-gnu-emacs

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

Hi Stefan,

>> I use my own `display-buffer-function' to have emacs split windows
>> horizontally by default. And, of course, I forgot to handle the
>> pop-up-frames case. Now I tried adding it, but I don't get it right. How
>> do I create a new frame and display a given buffer in it?
>
> You might try:
>
>   (let ((display-buffer-function nil)
>         (pop-up-frames t))
>     (display-buffer <buffer>))

Yes, that works. Thanks a lot.

Bye,
Tassilo
-- 
People sometimes  ask me if it  is a sin in  the Church of  Emacs to use
vi. Using a free  version of vi is not a sin; it  is a penance. So happy
hacking. (Richard M. Stallman)

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

end of thread, other threads:[~2007-07-22 12:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-18 22:31 Emacs Lisp Q: Switch Emacs Frame Between Current/Original FVWM Desktop? Edward
2007-07-19  7:24 ` Andrea Vettorello
2007-07-19  7:45 ` Anselm Helbig
2007-07-19  8:41 ` Floyd L. Davidson
2007-07-19  9:02   ` Tassilo Horn
2007-07-19 18:17     ` Stefan Monnier
2007-07-19 19:01       ` Tassilo Horn
2007-07-19 20:45         ` Stefan Monnier
2007-07-20  8:07           ` Tassilo Horn
2007-07-21  4:29             ` Stefan Monnier
2007-07-21  7:55               ` Tassilo Horn
2007-07-22  3:33                 ` Stefan Monnier
2007-07-22 12:29                   ` Tassilo Horn
2007-07-19 17:07 ` Xiao-Yong Jin
2007-07-20  4:29 ` Tim X

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.