bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

after-init-hook not executed under Linux?


From: Marc Levoy
Subject: after-init-hook not executed under Linux?
Date: 7 Sep 2002 18:32:20 -0700

Dear Emacs maintainers,

I just upgraded from Emacs 20.7 to 21.2, and under version 21, I am having
unexpected trouble setting my initial screen height in my .emacs init file.  In
trying to work around this problem, I discovered (I believe) that
after-init-hook is not being executed in Linux Emacs, although it *is* being
executed in Windows Emacs.


Some details:

I set the initial frame height using a command line option, "-geometry 80x60".
Then, when Emacs encounters the following code in my init file:

        (if (fboundp 'tool-bar-mode)
                (tool-bar-mode -1))

it shortens the window by 2 lines.  The obvious way to compensate for this
shortening is to change my command line option to "-geometry 80x62".
Unfortunately, this doesn't work, perhaps because Emacs checks my proposed
frame height against the actual height of my screen (or my Exceed window),
which is only 60 lines.

As a workaround, I tried resetting the frame height at the end of my init file,
using "set-frame-height".  This doesn't work either; Emacs ignores the command,
perhaps because of the order in which it applies such requests relative to
checking against the maximum allowing frame height.

As a last-ditch workaround, I tried resetting the frame height by using
"after-init-hook".  Specifically, I placed the following code in my init file:

        (add-hook 'after-init-hook 'mem-after-init-hook)
        (defun mem-after-init-hook ()
                (set-frame-height (selected-frame) 60)
        )

This works in Emacs 21.2 under Windows 2000, but not in Emacs 21.2 under Linux.
In fact, under Linux, this hook appears never to get executed at all.  (I
verified this by asking the hook to insert text in a buffer, which I could look
at later.  It inserted the text correctly under Windows, but not under Linux.)


More details:

On Linux, I am running "GNU Emacs 21.2.1 (i386-redhat-linux-gnu, X toolkit,
Xaw3d scroll bars) of 2002-04-08 on porky.devel.redhat.com" on a Linux 7.3
system, displaying either on my Linux desktop or through Exceed 7.0 to a
Windows 2000 system.  On Windows, I am running "GNU Emacs 21.2.1
(i386-msvc-nt5.0.2195) of 2002-03-19 on buffy".


Any wisdom on why after-init-hook doesn't seem to be getting executed?
Or any wisdom on forcing my frame height to be what I want?

-Marc Levoy
 Associate Professor
 Computer Science Department
 Stanford University




reply via email to

[Prev in Thread] Current Thread [Next in Thread]