[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Trying to right-align my window on startup
From: |
Mickey Ferguson |
Subject: |
Trying to right-align my window on startup |
Date: |
Wed, 8 Jan 2014 20:11:30 +0000 |
On most of my systems (which are running Windows ranging from XP to Windows 7),
when I start up emacs I want to right-align the window, with the top of the
window set to the top of the screen and the right (or left) edge of the window
touching the right (or left) edge of the screen. I have an environment
variable, emacs_alignment, that defines whether or not it should be left or
right. I wrote a function that does this nicely:
(defun align-window ()
"fix window positioning"
(interactive)
(if (equal (getenv "emacs_alignment") "right")
(align-window-right)
(align-window-left))
)
(defun align-window-left ()
"align window to left window edge"
(interactive)
(set-frame-position (selected-frame) 0 0)
)
(defun align-window-right ()
"align window to right window edge"
(interactive)
(set-frame-position (selected-frame) -1 0)
)
If I execute this function after emacs has started up, it works perfectly. If
I throw it into my .emacs file, it doesn't seem to do anything. (The above
code is found in MF-Init.el, which of course is also byte-compiled.) Here is
my .emacs file:
(condition-case error
(progn
;;; -*-Emacs-Lisp-*-
; want to start editing immediately
(setq-default inhibit-startup-message t)
(setq-default inhibit-startup-echo-area-message t)
(add-hook 'after-init-hook 'align-window)
(load-library "MF-Init")
;;; I also tried putting (align-window) in here, but that also did nothing.
)
(error (progn (ding)
(message "%s %s"
"There is an error in your ~/.emacs file."
"Press any key to enter the debugger.")
(discard-input)
(sit-for 1000)
(debug 'error error))))
Any idea how to get this function to execute properly upon the completion of
every other bit of initialization? Please reply directly to my email (Mickey
dot Ferguson at CassidianCommunications dot com) since we do not have a valid
news feed. Thanks for any help you can provide!
- Trying to right-align my window on startup,
Mickey Ferguson <=