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: RE: Trying to right-align my window on startup Date: Fri, 10 Jan 2014 22:31:46 +0000 Message-ID: References: <83r48idw6z.fsf@gnu.org> <83mwj5ekrs.fsf@gnu.org> <28ab7799-fdc5-47c4-9ac0-f7db66771e7e@default> 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 1389393129 28968 80.91.229.3 (10 Jan 2014 22:32:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Jan 2014 22:32:09 +0000 (UTC) To: "Emacs Help (help-gnu-emacs@gnu.org)" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 10 23:32:15 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 1W1kch-0007tI-4j for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Jan 2014 23:32:15 +0100 Original-Received: from localhost ([::1]:59343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1kcg-0001vr-Ld for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Jan 2014 17:32:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1kcQ-0001vb-Uy for help-gnu-emacs@gnu.org; Fri, 10 Jan 2014 17:32:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1kcK-0002T1-SZ for help-gnu-emacs@gnu.org; Fri, 10 Jan 2014 17:31:58 -0500 Original-Received: from mail.plantcml-eads.com ([67.151.52.7]:34909 helo=cassidiancommunications.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1kcK-0002Sj-Ix for help-gnu-emacs@gnu.org; Fri, 10 Jan 2014 17:31:52 -0500 Original-Received: from ([172.16.4.12]) by mail.cassidiancommunications.com with ESMTP with TLS id 8YS9KF1.26473531; Fri, 10 Jan 2014 14:31:47 -0800 Original-Received: from TEMCAS01.peinet.peinc.com ([::1]) by TEMCAS01.peinet.peinc.com ([::1]) with mapi id 14.02.0387.000; Fri, 10 Jan 2014 14:31:47 -0800 Thread-Topic: Trying to right-align my window on startup Thread-Index: AQHPDLdlRbFj07j3V0q8XEvV7E9P1Zp8c0CAgAA3FHCAALYrgIABK7kw In-Reply-To: <28ab7799-fdc5-47c4-9ac0-f7db66771e7e@default> 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-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:95345 Archived-At: >> The problem here is that I want a generic file that will work for=20 >> multiple screen dimensions. A while ago I had tried going down the=20 >> path you have suggested here and just didn't know all of the screen=20 >> parameters, nor how to convert from one unit type to another. >> That's why the -1 was used, as an attempt at using emacs' knowledge of=20 >> the screen's right edge location. > >Just use a negative integer (e.g. -1) to set the number of pixels from the= right or bottom edge of your >screen. The problem is not that I can't get the code to make the window move to the= right position. I've got the align-window function (below) working just f= ine. The problem is that I can't get it to execute automatically upon emac= s startup. I can't figure out how or where to place it so that it executes= _and works properly_. I put it my MF-Init.el file that is loaded upon sta= rtup. In the load of that library, it automatically sets the desired font = and calls align-window. If I just start up emacs, I see the message "Ran a= lign-window-right" in the message area of the window, but it isn't right-al= igned. If I do a M-x load-library of that same file, it loads it (again), = but this time it really does move the window to right alignment. Any clues what I'm doing wrong, or how to solve it? (defun align-window () "fix window positioning" (interactive) (if (equal (getenv "emacs_alignment") "right") (align-window-right) (align-window-left)) ) ;;;set C-x \ (backslash) to align-window (global-set-key "\C-x\\" 'align-window) (defun align-window-left () "align window to left window edge" (interactive) (set-frame-position (selected-frame) 0 0) (message "Ran align-window-left") ) (defun align-window-right () "align window to right window edge" (interactive) (set-frame-position (selected-frame) -1 0) (message "Ran align-window-right") )