[OS X Emacs] Dynamic window positioning in Aquamacs

Adrian adrian.down at gmail.com
Fri Oct 10 16:41:33 EDT 2008

David, your point is well-taken.  You're right about your work with
Aquamacs: I simply could not use Emacs before the OS X native version.  With
Aquamacs, I am able to hold my dislike of Emacs at a manageable level.  I
would be more inclined to help with this project, however I feel Aquamacs is
a band-aid for many deeper problems in Emacs.  I have considered trying to
remedy many of what I see as Emac's failings and have gone so far as to try
to edit the original source, but the task is just too immense.  Moreover, I
doubt that my goals of creating a more modern application would be well
received as long as "rms" is at he helm of Emacs.  I know that somebody has
to start somewhere or else change will never occur, but for me, the starting
point would probably be gutting the entire thing, rebuilding it in C, and
putting an attractive, intuitive GUI on the front.  I have a feeling that
this could possibly take the better part of my free for years to come.
As for the *scratch* buffer, I feel that it is an anachronism that is a
useless annoyance to the vast majority of users (of course I may be flamed
by adamant scratch diehards).  I would like to emulate the behavior of most
modern applications:
1) If I open the application with no arguments, either from the command line
or dock, it opens a blank window called "untitled".  If I edit this file and
then try to close it, I should be prompted to save it.  If I open another
2) Every time I open a new document from the toolbar, I should see a similar
"untitled" window.
3) If I have a blank "untitled" buffer open and I open another file, either
from the command line or with the "open" dialog, the existing "untitled"
buffer should be killed and replaced in the existing window with the
recently opened file.
3) If I open the application with a file specified, the application should
open the file and I should never see the *scratch* buffer.

I will keep looking for a workaround and post what I find.  The nearest I
have come thus far is simply adding (new-empty-buffer) in Preferences.el.
 This solves the problem of the initial *scratch* window.  The only problem
is that this buffer is not closed and can pop up in a separate frame later
on.  More on this as I am able to find something...

Thanks very much, Nathaniel.  Your script did exactly what I was looking
for.  I added a modulo to cycle the window positions.  Now, I'd like to see
if there is a way to put the mouse focus in the most recently-created frame.
 My current use of after-make-frame-hook (code below) doesn't seem to have
any effect.  Isn't the most recently-created frame passed to all functions
in this hook by default?

Thanks again for the help,

(defun default-frame-alist-update ()
  (let* ((framecount (length (visible-frame-list)))
     (fcm (mod framecount 3))
     (xoffset (- 1135 (* fcm 400))))
    (setq default-frame-alist
      `((left . ,xoffset)
        (top . 0)
        (width . 60)
        (height . 73)))))
(add-hook 'before-make-frame-hook 'default-frame-alist-update)
(add-hook 'after-make-frame-hook 'select-frame-set-input-focus)

2008/10/10 David Reitter <david.reitter at gmail.com>

> On 10 Oct 2008, at 13:46, Adrian wrote:
>  "Roll your own" is definitely not what I was hoping to hear :-(.  I have
>> no knowledge of lisp nor any desire to learn for the sole sake of
>> implementing behaviour that Emacs should support by default.
> You can learn, and it's not too hard.
> If I hadn't learned to do Lisp, you would probably be using a different
> piece of software to edit your stuff... But I appreciate that very few
> people seem to be willing to spend time on improving free software.
> If you can't find anyone who will write you the code you need, then get in
> touch by e-mail and I'll either let you know an hourly rate, or put you in
> touch with Elisp savvy people who can do this in a couple of paid-for hours.
>   If I were good enough to edit the source, I would have abolished the
>> infernal scratch buffer long ago.
> Out of interest, is it the *scratch* buffer that annoys you, or the
> persistency across sessions?  Or just the fact that it's always shown when
> you start up Aquamacs?
>  Smart positioning seems to be confusing the window positioning whether it
>> is turned on or off.  Even when it is turned off, I have to specify both
>> "default-" and "initial-frame-alist" parameters for my specifications to
>> take any effect.  Shouldn't I be able to specify these parameters
>> separately?
> Yes, you should be able to, and they have slightly different meanings as
> documented.
>> BTW, if anyone has any suggestions for a hack whereby I never have to see
>> the scratch buffer again, I would greatly appreciate it.  Perhaps this is a
>> subject for another post though...
> Well, very hacky:
> (run-with-idle-timer 0.2 nil (lambda () (let ((one-buffer-one-frame t))
> (with-current-buffer "*scratch*" (kill-buffer-and-window )))))
> You may see another buffer (*Messaged* for instance) in some instances
> though...  Emacs cannot not display any buffer in a window.
> --
> http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
> http://aquamacs.org/donate -- Could we help you? Return the favor and
> support the Aquamacs Project!
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20081010/b8d76179/attachment.html>

More information about the MacOSX-Emacs mailing list