all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "Alex Deva" <alxx@indigenious.ro>
Cc: Help-gnu-emacs@gnu.org
Subject: RE: fit-frame every time i open a file
Date: Mon, 15 Oct 2007 13:54:16 -0700	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICKEKBEAAA.drew.adams@oracle.com> (raw)
In-Reply-To: <3575DEDA-88CF-442C-BE9D-1AB1A5E84383@indigenious.ro>

> > 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)

`M-:' means hold the Meta key (probably the Alt key) pressed while you hit
`:'. It is bound to command `pp-eval-expression', which lets you type a Lisp
expression to evaluate.

> 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.

It sounds like either `fit-frame' was not called, it was called but didn't
do anything, or it did something that was undone afterward.

> 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. :(

FYI - You can use `C-h f' to describe any function. The *Help* buffer
showing the description usually tells you what file it is defined in and
provides a link to its definition.

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

> OK.

> 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.

If `after-make-frame-functions' has value (fit-frame), then `fit-frame'
should be called. You can do this to see if it is called:

M-x debug-on-entry RET fit-frame RET

You can cancel such debugging this way: M-x cancel-debug-on-entry RET

If `fit-frame' is not being called, then you'll need to get some help from
an Aquamacs user. It sounds to me like it is not getting called, because
when you call it by hand it apparently works correctly. Make sure you
spelled everything correctly.

C-h v after-make-frame-functions should show this: (fit-frame)

If `fit-frame' is getting called (as shown by entering the debugger), then
you need to figure out why it doesn't fit the frame. Read the doc string of
`fit-frame' to understand it, including the conditions under which it does
nothing. It's possible that the values of the fit-frame user options (e.g.
`fit-frame-inhibit-fitting-flag') are preventing resizing.

Again, however, I doubt that it is getting called at all, since calling it
manually does resize the frame correctly.

> > 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...

Do you see "If it does" and "In that case" in what I wrote? From what you
wrote, it does not: `after-make-frame-functions' = (fit-frame) does not
solve the problem. So the presence of `set-mode-style-after-make-frame' is
not the problem.

> 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).

Yes, and you said that it correctly resizes the frame when you call it
manually. I suspect it is not being called, but I can't say why. I also
don't know what you meant by it resizing OK with short lines, but not when
there are long lines. If it works with short lines, then it would seem to be
getting called as an after-make-frame function. Does it resize correctly
with long-lines if you call it manually? Something doesn't make sense to me
in your description.

> Given this new information, is there anything else I could try?

See above.

If `fit-frame' is called, you can also try stepping through it in the
debugger (`d') to see what it is doing. Why it might do something wrong when
called in a hook and when called manually is unclear. I doubt that that is
what's happening - I suspect that it is not called from the hook.

> 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,

I think that there are Aquamacs people who read this list. They might not be
willing or able to help.

The things you need to determine for sure are these:

1. Whether `fit-frame' gets called as an after-make-frame function.
2. Exactly what changes if you have short or long lines.

If `fit-frame' is not called by the hook, then I cannot help you. If it is
called but it doesn't DTRT, then I can try to help.

  reply	other threads:[~2007-10-15 20:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-15 13:07 fit-frame every time i open a file alxx
2007-10-15 15:45 ` Drew Adams
2007-10-15 16:13   ` alxx
2007-10-15 17:02     ` Drew Adams
2007-10-15 17:44     ` Peter Dyballa
2007-10-15 18:15       ` Drew Adams
2007-10-15 18:23         ` Alex Deva
2007-10-15 18:41           ` Drew Adams
2007-10-15 20:12             ` Alex Deva
2007-10-15 20:54               ` Drew Adams [this message]
2007-10-16  7:15                 ` Alex Deva
2007-10-16 14:18                   ` Drew Adams
2007-10-16  8:44               ` Peter Dyballa
     [not found]             ` <mailman.2101.1192479183.18990.help-gnu-emacs@gnu.org>
2007-10-21  7:57               ` David Reitter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DNEMKBNJBGPAOPIJOOICKEKBEAAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=Help-gnu-emacs@gnu.org \
    --cc=alxx@indigenious.ro \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.