[OS X Emacs] Dynamic window positioning in Aquamacs

Nathaniel Cunningham nathaniel.cunningham at gmail.com
Fri Oct 10 14:54:57 EDT 2008


On Fri, Oct 10, 2008 at 11:42 AM, Adrian <adrian.down at gmail.com> wrote:

I've fiddled a bit and come up with a chunk of code that may do what you
want.  This approach is much more crude than what could be achieved with
David's suggested route, and (like the code you tried) will not work
properly beyond a certain number of frames.

--Nathaniel

;; function to update `left' value in default-frame-alist
(defun default-frame-alist-update ()
  (let* ((framecount (length (visible-frame-list)))
     (xoffset (- 1005 (* framecount 300))))
    (setq default-frame-alist
      `((left . ,xoffset)
        (top . 0)
        (width . 80)
        (height . 73)))))

;; call the above function just before creating a new frame
(add-hook 'before-make-frame-hook 'default-frame-alist-update)



Hello,
> I'm trying to configure Aquamacs so that new windows (aka emacs "frames")
> will pop up in a tiled fashion.  I know Aquamacs has a tiling option, but I
> don't want the Aquamacs windows to use the entire screen and I don't want to
> have to retile every time I open another window.  Basically, I want to be
> able to specify the default position of windows without having all
> subsequent windows open in the exact same location.
>
> I tried to write a few lines in my .emacs file to accomplish this, but thus
> far I've failed.  The relevant lines from my .emacs file are at the end of
> this message.  Hopefully its just a lisp syntax issue on my part, as I've
> never used lisp outside of basic Emacs configuration.  There are two types
> of behavior Aquamacs exhibits with these lines, depending on whether
> smart-frame-positioning-mode is enabled or not.  If so, my positioning
> arguments are ignored and all Emacs windows are popped on the left boundary
> of the screen, presumably with "left" set to 0.  If
> smart-frame-positioning-mode is disabled, Aquamacs fails on startup with the
> following output to the message buffer:
> Wrong type argument: integerp, xoffset
>
> Is what I am trying to accomplish possible in Aquamacs, and if so, is my
> method below the proper way to go about it?  Let me know if there's any
> other useful information I can provide.
>
> Thanks,
> Adrian
>
> (setq framecount (length (visible-frame-list)))
> (setq xoffset (- 1005 (* framecount 300)))
> (setq default-frame-alist
>       (append
>        '((left . xoffset)
>  (top . 0)
>  (width . 80)
>  (height . 73))
>        default-frame-alist))
>
> (setq initial-frame-alist
>       (append
>        '((left . 1005)
>  (top . 0)
>  (width . 80)
>  (height . 73))
>        initial-frame-alist))
>
> _____________________________________________________________
> 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/296308c6/attachment.html>


More information about the MacOSX-Emacs mailing list