all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* New frame position (FSF Emacs on Windows)
@ 2003-02-07 20:37 Paul Moore
  2003-02-07 21:25 ` Kai Großjohann
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Paul Moore @ 2003-02-07 20:37 UTC (permalink / raw)


I currently use XEmacs 21.5.10 on Windows (2000 and XP), mainly for
news/mail via Gnus and occasionally for general editing tasks. I'm
considering switching over to FSF Emacs 21.2.1, mainly because it seems to
start up enormously faster. (Is this generally true, or is it just me? 
If it is true, what causes the difference?)

Anyway, one annoying feature in FSF Emacs is that when I open a new
frame (for example, with C-X 5 f) it appears in *exactly* the same
position on screen as the current frame. It therefore looks like I
didn't open a new frame!

This behaviour does not happen in XEmacs, where new frames are created
slightly offset from the current frame's present location (using what
looks like the standard Windows algorithm, which works pretty well...)

I've searched the documentation, and the Emacs Wiki, and I haven't
found a way of getting FSF Emacs to work the same (new frame offset
from the previous). The variable default-frame-alist seems to be the
main method of control, but that only lets me set a fixed position -
precisely the opposite of what I want!

The behaviour seems to be built into the core code, as what I describe
is what happens on systems with no special customisation.

How can I get the frame creation behaviour I want from FSF Emacs?

Thanks,
Paul.

PS I'm happy to write elisp code if I need to - that doesn't worry
   me. However, I don't know the algorithm for Windows' placement
   behaviour - I just know that it looks good to me. So I need more
   than just a description of how to make the location
   change. Sorry...
-- 
This signature intentionally left blank

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-07 20:37 New frame position (FSF Emacs on Windows) Paul Moore
@ 2003-02-07 21:25 ` Kai Großjohann
  2003-02-08 17:42   ` Paul Moore
  2003-02-07 22:04 ` Jesper Harder
  2003-02-08  2:30 ` Galen Boyer
  2 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-02-07 21:25 UTC (permalink / raw)


Paul Moore <gustav@morpheus.demon.co.uk> writes:

> Anyway, one annoying feature in FSF Emacs is that when I open a new
> frame (for example, with C-X 5 f) it appears in *exactly* the same
> position on screen as the current frame. It therefore looks like I
> didn't open a new frame!

Do you have left and top in default-frame-alist?  Does it help to
remove them?
-- 
A turnip curses Elvis

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-07 20:37 New frame position (FSF Emacs on Windows) Paul Moore
  2003-02-07 21:25 ` Kai Großjohann
@ 2003-02-07 22:04 ` Jesper Harder
  2003-02-08 18:43   ` Paul Moore
  2003-02-08  2:30 ` Galen Boyer
  2 siblings, 1 reply; 10+ messages in thread
From: Jesper Harder @ 2003-02-07 22:04 UTC (permalink / raw)


Paul Moore <gustav@morpheus.demon.co.uk> writes:

> I currently use XEmacs 21.5.10 on Windows (2000 and XP), mainly for
> news/mail via Gnus and occasionally for general editing tasks.
>
> Anyway, one annoying feature in FSF Emacs is that when I open a new
> frame (for example, with C-X 5 f) it appears in *exactly* the same
> position on screen as the current frame. It therefore looks like I
> didn't open a new frame!

This doesn't help you, but on X this usually something you adjust in you
window manager.  For me a new frame is placed slightly offset from the
previous one by default.  There's also a plethora of other placement
algorithms I could select.

> How can I get the frame creation behaviour I want from FSF Emacs?

I'm not sure exactly which algorithm you want.  But this should give you
an idea: It places a new frame offset by 15 pixels from the previous:

(defun my-frame-position ()
  (let ((left (or (cdr (assq 'left default-frame-alist)) 0))
	(top (or (cdr (assq 'top default-frame-alist)) 0)))
    (setq default-frame-alist 
	  (cons (cons 'left (+ left 15))
		(assq-delete-all 'left default-frame-alist))
	  default-frame-alist
	  (cons (cons 'top (+ top 15))
		(assq-delete-all 'top default-frame-alist)))))

(add-to-list 'default-frame-alist '(user-position . t))
(add-hook 'before-make-frame-hook 'my-frame-position)

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-07 20:37 New frame position (FSF Emacs on Windows) Paul Moore
  2003-02-07 21:25 ` Kai Großjohann
  2003-02-07 22:04 ` Jesper Harder
@ 2003-02-08  2:30 ` Galen Boyer
  2003-02-08 18:46   ` Paul Moore
  2 siblings, 1 reply; 10+ messages in thread
From: Galen Boyer @ 2003-02-08  2:30 UTC (permalink / raw)


On Fri, 07 Feb 2003, gustav@morpheus.demon.co.uk wrote:

> I currently use XEmacs 21.5.10 on Windows (2000 and XP), mainly for
> news/mail via Gnus and occasionally for general editing tasks. I'm
> considering switching over to FSF Emacs 21.2.1, mainly because it
> seems to start up enormously faster. (Is this generally true, or is it
> just me?  If it is true, what causes the difference?)

I think most people don't consider start up time as a factor for their
decision in using versions of Emacs.  Most keep Emacs running for
weeks/months. 
-- 
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-07 21:25 ` Kai Großjohann
@ 2003-02-08 17:42   ` Paul Moore
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Moore @ 2003-02-08 17:42 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> Paul Moore <gustav@morpheus.demon.co.uk> writes:
>
>> Anyway, one annoying feature in FSF Emacs is that when I open a new
>> frame (for example, with C-X 5 f) it appears in *exactly* the same
>> position on screen as the current frame. It therefore looks like I
>> didn't open a new frame!
>
> Do you have left and top in default-frame-alist?  Does it help to
> remove them?

No I don't. It looks like the default in XEmacs is to create the frame
with Windows' "Let the window manager place the frame" option set,
whereas with Emacs, the default is to specify the frame position, even
if the user doesn't have anything in default-frame-alist.

Paul.
-- 
This signature intentionally left blank

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-07 22:04 ` Jesper Harder
@ 2003-02-08 18:43   ` Paul Moore
  2003-02-09  4:31     ` Jesper Harder
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Moore @ 2003-02-08 18:43 UTC (permalink / raw)


Jesper Harder <harder@myrealbox.com> writes:

> Paul Moore <gustav@morpheus.demon.co.uk> writes:
>
>> I currently use XEmacs 21.5.10 on Windows (2000 and XP), mainly for
>> news/mail via Gnus and occasionally for general editing tasks.
>>
>> Anyway, one annoying feature in FSF Emacs is that when I open a new
>> frame (for example, with C-X 5 f) it appears in *exactly* the same
>> position on screen as the current frame. It therefore looks like I
>> didn't open a new frame!
>
> This doesn't help you, but on X this usually something you adjust in you
> window manager.  For me a new frame is placed slightly offset from the
> previous one by default.  There's also a plethora of other placement
> algorithms I could select.

Yes, I have seen this in X. As usual in Windows, there aren't any
options - you get what Bill things is best for you. Unfortunately, in
this instance, I actually like the Windows behaviour :-)

>> How can I get the frame creation behaviour I want from FSF Emacs?
>
> I'm not sure exactly which algorithm you want.  But this should give you
> an idea: It places a new frame offset by 15 pixels from the previous:
>
> (defun my-frame-position ()
>   (let ((left (or (cdr (assq 'left default-frame-alist)) 0))
> 	(top (or (cdr (assq 'top default-frame-alist)) 0)))
>     (setq default-frame-alist 
> 	  (cons (cons 'left (+ left 15))
> 		(assq-delete-all 'left default-frame-alist))
> 	  default-frame-alist
> 	  (cons (cons 'top (+ top 15))
> 		(assq-delete-all 'top default-frame-alist)))))
>
> (add-to-list 'default-frame-alist '(user-position . t))
> (add-hook 'before-make-frame-hook 'my-frame-position)

Phew. That's not something I'd have worked out for myself! It's a good
start, but there's a bit more to the "Windows behaviour" - if the
calculated position is "too far" (off the screen, or overlapping the
taskbar) the window is put back up at the top left. Also, rather than
a fixed 15 pixels (or whatever) the Windows behaviour is to go down by
the width of the title bar (user configurable) and right by the size
of the "system menu" icon. So you need to do a lot of digging in
system parameters to get the right values.

Most of this is nit-picking, and in practice, a fixed amount is
perfectly OK. It's just that I like my applications to "look native"
(Windows-like on Windows, KDE-style on KDE, Gnome compatible on Gnome,
etc etc) and anything that doesn't "fit" gives me a mildly
uncomfortable feeling. (It's the same reason I don't like Tk
applications, or Cygwin).

We're well into religious war territory now, though, so I'll shut
up :-) Thanks for the code, which is fine for what I need.

Paul.
-- 
This signature intentionally left blank

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-08  2:30 ` Galen Boyer
@ 2003-02-08 18:46   ` Paul Moore
  2003-02-09  3:32     ` Galen Boyer
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Moore @ 2003-02-08 18:46 UTC (permalink / raw)


Galen Boyer <galenboyer@hotpop.com> writes:

> On Fri, 07 Feb 2003, gustav@morpheus.demon.co.uk wrote:
>
>> I currently use XEmacs 21.5.10 on Windows (2000 and XP), mainly for
>> news/mail via Gnus and occasionally for general editing tasks. I'm
>> considering switching over to FSF Emacs 21.2.1, mainly because it
>> seems to start up enormously faster. (Is this generally true, or is it
>> just me?  If it is true, what causes the difference?)
>
> I think most people don't consider start up time as a factor for their
> decision in using versions of Emacs.  Most keep Emacs running for
> weeks/months. 

Unfortunately, I tend to start & stop programs regularly. Maybe it's
not the most effective way to work with Emacs, but it's a *^!%" hard
habit to break :-)

[I suppose I'd better not mention that I often use Vim rather than any
form of Emacs, because it starts so much faster? :-)]

Paul.
-- 
This signature intentionally left blank

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-08 18:46   ` Paul Moore
@ 2003-02-09  3:32     ` Galen Boyer
  0 siblings, 0 replies; 10+ messages in thread
From: Galen Boyer @ 2003-02-09  3:32 UTC (permalink / raw)


On Sat, 08 Feb 2003, gustav@morpheus.demon.co.uk wrote:

> Unfortunately, I tend to start & stop programs regularly. 

Its not unfortunate, but it is not the way to get the most from Emacs.
If you are going to stop and start Emacs regularly, then you are
probably best served by some other quick hit type environment.  A large
part of the power of Emacs is that it remembers where you have been and
what you have chosen and what you have looked at ...  If you continue to
shut it down, its memory is very minimal and therefore Emac might seem
minimal.  If you leave it open, then Emacs can continue to add to its
"memory". 

-- 
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-08 18:43   ` Paul Moore
@ 2003-02-09  4:31     ` Jesper Harder
  2003-02-09 11:52       ` Paul Moore
  0 siblings, 1 reply; 10+ messages in thread
From: Jesper Harder @ 2003-02-09  4:31 UTC (permalink / raw)


Paul Moore <gustav@morpheus.demon.co.uk> writes:

> Jesper Harder <harder@myrealbox.com> writes:
>
>> This doesn't help you, but on X this usually something you adjust in you
>> window manager.
>
> Yes, I have seen this in X. As usual in Windows, there aren't any
> options - you get what Bill things is best for you. Unfortunately, in
> this instance, I actually like the Windows behaviour :-)

I think Emacs ought to follow the standard behaviour on ms-windows.
Submit a bug report :-)

> Phew. That's not something I'd have worked out for myself! It's a good
> start, but there's a bit more to the "Windows behaviour" - if the
> calculated position is "too far" (off the screen, or overlapping the
> taskbar) the window is put back up at the top left. Also, rather than
> a fixed 15 pixels (or whatever) the Windows behaviour is to go down by
> the width of the title bar (user configurable) and right by the size
> of the "system menu" icon.

OK, here's an improved version:

(require 'assoc)
(defvar my-frame-position-x-offset 20)
(defvar my-frame-position-y-offset 20)
(defvar my-frame-position-taskbar-height 30)

(defun my-frame-position ()
  (let ((left (+ my-frame-position-x-offset 
		 (or (frame-parameter nil 'left) 0)))
	(top (+ my-frame-position-y-offset 
		(or (frame-parameter nil 'top) 0))))
    (when (or (> (+ (frame-pixel-width) left) 
		 (display-pixel-width))
	      (> (+ (frame-pixel-height) top 
		    my-frame-position-taskbar-height)
		 (display-pixel-height)))
      (setq left 0 top 0))
    (aput 'default-frame-alist 'left left)
    (aput 'default-frame-alist 'top top)))

(aput 'default-frame-alist 'user-position t)
(add-hook 'before-make-frame-hook 'my-frame-position)

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

* Re: New frame position (FSF Emacs on Windows)
  2003-02-09  4:31     ` Jesper Harder
@ 2003-02-09 11:52       ` Paul Moore
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Moore @ 2003-02-09 11:52 UTC (permalink / raw)


Jesper Harder <harder@myrealbox.com> writes:

> I think Emacs ought to follow the standard behaviour on ms-windows.
> Submit a bug report :-)

OK, I'll do that.

> OK, here's an improved version:

Wow. Thanks for that - the original really was OK for me. This one's
even better, though.

Thanks,
Paul.
-- 
This signature intentionally left blank

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

end of thread, other threads:[~2003-02-09 11:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-07 20:37 New frame position (FSF Emacs on Windows) Paul Moore
2003-02-07 21:25 ` Kai Großjohann
2003-02-08 17:42   ` Paul Moore
2003-02-07 22:04 ` Jesper Harder
2003-02-08 18:43   ` Paul Moore
2003-02-09  4:31     ` Jesper Harder
2003-02-09 11:52       ` Paul Moore
2003-02-08  2:30 ` Galen Boyer
2003-02-08 18:46   ` Paul Moore
2003-02-09  3:32     ` Galen Boyer

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.