From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Paul Moore Newsgroups: gmane.emacs.help Subject: Re: New frame position (FSF Emacs on Windows) Date: Sat, 08 Feb 2003 18:43:21 +0000 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1044748723 9819 80.91.224.249 (8 Feb 2003 23:58:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 8 Feb 2003 23:58:43 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18herp-0002YE-00 for ; Sun, 09 Feb 2003 00:58:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18heti-0007my-04 for gnu-help-gnu-emacs@m.gmane.org; Sat, 08 Feb 2003 19:00:38 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 61 Original-NNTP-Posting-Host: morpheus.demon.co.uk Original-X-Trace: news.demon.co.uk 1044748570 23567 158.152.8.30 (8 Feb 2003 23:56:10 GMT) Original-X-Complaints-To: abuse@demon.net Original-NNTP-Posting-Date: Sat, 8 Feb 2003 23:56:10 +0000 (UTC) Cancel-Lock: sha1:Wysuxct7jIbUxwW7GWwdqbb4FCM= User-Agent: Gnus/5.090013 (Oort Gnus v0.13) XEmacs/21.5 (burdock, i586-pc-win32) Hamster/2.0.0.0 Original-Xref: shelby.stanford.edu gnu.emacs.help:109964 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:6469 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:6469 Jesper Harder writes: > Paul Moore 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