[Top][All Lists]

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

Re: fit-frame every time i open a file

From: Alex Deva
Subject: Re: fit-frame every time i open a file
Date: Mon, 15 Oct 2007 23:12:46 +0300

On Oct 15, 2007, at 9:41 PM, Drew Adams wrote:

Sorry Drew, but as I said, I'm more of a beginner.

No apology needed. My fault for not noticing that.

I actually take pride in that :)

I saved the two libraries you recommended, and then loaded both
manually with load-file. So... what now? I can't call add-hook from
inside emacs (or I don't know how). What am I supposed to do from
this point on? How do I test the hook?

After you load the *.el files with `load-file', do this (mentioned in the
file Commentary):

M-: (add-hook 'after-make-frame-functions 'fit-frame)

I added the hook manually (I honestly didn't know about M-: because I'm not a LISP programmer, though it's on my list) and the effect was this: any file I opened came up in a frame exactly the same dimensions as the current frame (which, as it happens, had been fit-framed). The dimensions of the new frames are now irrespective of the frame best fit (i.e., if I manually call fit-frame, the frame resizes).

However, if I resize the current window by dragging its corner (Aquamacs lets you do that), then the files I subsequently open still have the same dimensions that the current window originally had. In other words, width/height seem to have been frozen when I added the hook, somehow.

If that doesn't fix the problem, then take a look at the value of
`after-make-frame-functions'. If it contains more than just `fit-frame', try
setting it to nil (empty) and then adding `fit-frame' back again:

Taking a look at the variable in question, I get this:

(fit-frame set-mode-style-after-make-frame)

A quick grep showed that the second call has nothing to do with either of your two libraries. I don't know how to look it up inside emacs to see where it comes from. :(

M-: (setq after-make-frame-functions nil)
M-: (add-hook 'after-make-frame-functions 'fit-frame)

The result should then be this:

C-h v after-make-frame-functions ==> (fit-frame)


Now again nothing happens when I open new files. They seem to open with the default width/height and are resized to best fit when I call fit-frame manually.

The above procedure is just to try to see if `fit-frame' does the right
thing at least when there are no other `after-make-frame-functions' present.
If it does, then there is likely interference among those functions. In that
case, you can try (starting with an empty list) adding them all back, in
different orders (e.g. try `fit-frame' first or last), to see if that helps.
You get the idea.

Thank you, I do, but since the test failed, I don't see the point in reversing the order of the only 2 functions that were hooked...

But see my previous reply about long lines. It sounds like this might just
be unrealistic expectations on your part. `fit-frame' makes the frame as
wide as its longest line, but it respects maximum limits that you can set.
See the `fit-frame' doc string.

I read everything you write carefully. I know (empirically) what fit-frame does and what it doesn't do, and we're not having a case of enforced line width limits (besides, those are accessible as configuration parameters within Aquamacs -- one of the reasons I thought fit-frame would be better integrated).

Given this new information, is there anything else I could try? The problem started off pretty simple, but now seems to be getting hairier... Aquamacs support is rather scarce, and I'm surprised to discover that nobody from their team is on this list also.

Thank you for your support so far,


reply via email to

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