unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* window alignment at startup
@ 2013-07-10 21:22 Mickey Ferguson
  2013-07-10 22:17 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Mickey Ferguson @ 2013-07-10 21:22 UTC (permalink / raw)
  To: help-gnu-emacs

I've coded the following function which works perfectly after a window
is already in existence:

 

(defun align-window ()

  "fix window positioning"

  (interactive)

  (set-frame-position (selected-frame)

                      (if (equal (getenv "emacs_alignment") "right") -1
0) 0)

  )

 

If I have the emacs_alignment environment variable defined and set to
"right", it aligns the window to the right edge of my screen.
Otherwise, it left-aligns it.  The problem arises if I have
(align-window) in my .emacs.  If it's not set to "right", it properly
left-aligns, but if it's set to "right", it aligns it to some point near
the right edge, but not really there.  After emacs is fully loaded and
running, if I use M-x align-window, it works properly.  Note that my
.emacs results in setting a different font, which causes the window size
to change.

 

OK, to boil it down:  I want to execute this function as the last thing
emacs does before it's done - after loading the file(s), etc.  How do I
do this?  Replies directly to my email (Mickey.Ferguson - at -
cassidiancommunications - dot - com), since my work doesn't allow for
newsgroup access.

 

Thanks for any help you can provide!



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: window alignment at startup
  2013-07-10 21:22 window alignment at startup Mickey Ferguson
@ 2013-07-10 22:17 ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2013-07-10 22:17 UTC (permalink / raw)
  To: Mickey Ferguson, help-gnu-emacs


> (defun align-window ()
>  "fix window positioning"
>   (interactive)
>   (set-frame-position
>     (selected-frame)
>     (if (equal (getenv "emacs_alignment") "right") -1 0)
>     0))
> 
> OI want to execute this function as the last thing
> emacs does before it's done - after loading the file(s), etc. 

Try `C-h v after-init-hook'.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: window alignment at startup
       [not found] <mailman.763.1373491420.12400.help-gnu-emacs@gnu.org>
@ 2013-07-12  9:05 ` Emanuel Berg
  0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2013-07-12  9:05 UTC (permalink / raw)
  To: help-gnu-emacs

"Mickey Ferguson" <...> writes:

> (defun align-window ()
>   "fix window positioning"
>   (interactive)
>   (set-frame-position (selected-frame)

Does `set-frame-position' only work in X? Because it doesn't seem
to do anything for me.

I have the following to get a right margin of one char, in a Linux
VT:

;; left margin = 1 char; no right margin
(add-hook 'window-configuration-change-hook
 (lambda ()
   (set-window-margins
    (car (get-buffer-window-list (current-buffer)
                                 nil  ; do consider minibuffer
                                 t )) ; consider all frames
    1 0 )))

However, it is not optimal as

1) I'd like it for the minibuffer/echo area, to

2) I'd like it for the status bar, to, although I managed to setup
this somewhere else

3) Sometimes, for popup frames (for example, help) it doesn't
"kick in" until I hit `M-x', which is annoying. (I don't think
this is because of Help's View mode, because sometimes in some
other popup context - without View - I get the same behaviour -
although that's a possibility, for sure - either the hook doesn't
get fired, or it resets right after that).

But in most cases, it works OK.

As I always run Emacs in a tmux window, perhaps it is much easier
to fill the right margin with an extra char (a whitespace), in my
tmux setup? I don't know if you use tmux as well, otherwise that
could be worth exterminating.

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-12  9:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-10 21:22 window alignment at startup Mickey Ferguson
2013-07-10 22:17 ` Drew Adams
     [not found] <mailman.763.1373491420.12400.help-gnu-emacs@gnu.org>
2013-07-12  9:05 ` Emanuel Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).