From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mickey Ferguson Newsgroups: gmane.emacs.help Subject: Trying to right-align my window on startup Date: Wed, 8 Jan 2014 20:11:30 +0000 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389211921 1420 80.91.229.3 (8 Jan 2014 20:12:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jan 2014 20:12:01 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 08 21:12:07 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W0zTw-00072a-Ul for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Jan 2014 21:12:05 +0100 Original-Received: from localhost ([::1]:48757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0zTw-0006q5-Fh for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Jan 2014 15:12:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0zTb-0006pw-0Z for help-gnu-emacs@gnu.org; Wed, 08 Jan 2014 15:11:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0zTU-00083I-SN for help-gnu-emacs@gnu.org; Wed, 08 Jan 2014 15:11:42 -0500 Original-Received: from mail.plantcml-eads.com ([67.151.52.7]:32815 helo=cassidiancommunications.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0zTU-00082q-IL for help-gnu-emacs@gnu.org; Wed, 08 Jan 2014 15:11:36 -0500 Original-Received: from ([172.16.4.12]) by mail.cassidiancommunications.com with ESMTP with TLS id 8YS9KF1.26440100; Wed, 08 Jan 2014 12:11:32 -0800 Original-Received: from TEMCAS01.peinet.peinc.com ([::1]) by TEMCAS01.peinet.peinc.com ([::1]) with mapi id 14.02.0387.000; Wed, 8 Jan 2014 12:11:32 -0800 Thread-Topic: Trying to right-align my window on startup Thread-Index: Ac8MrdEtFz5BxvcGTwaixTFsAP7jKA== Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.10.30] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 67.151.52.7 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95309 Archived-At: 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 o= f the window set to the top of the screen and the right (or left) edge of t= he window touching the right (or left) edge of the screen. I have an envir= onment 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 a= bove 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 not= hing. ) (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 o= f every other bit of initialization? Please reply directly to my email (Mi= ckey dot Ferguson at CassidianCommunications dot com) since we do not have = a valid news feed. Thanks for any help you can provide!