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

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

Re: Add hook to end of `custom-create-buffer-internal'


From: Stefan Monnier
Subject: Re: Add hook to end of `custom-create-buffer-internal'
Date: Fri, 28 Jan 2005 09:58:16 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> *** cus-edit.el       08 Jan 2005 21:43:12 -0500      1.206
> --- cus-edit.el       28 Jan 2005 08:59:52 -0500      
> ***************
> *** 1249,1257 ****
>       (special-display-buffer-names nil)
>       (special-display-regexps nil)
>       (same-window-buffer-names nil)
> !     (same-window-regexps nil))
> !     (pop-to-buffer (custom-get-fresh-buffer name))
> !     (custom-buffer-create-internal options description)))
  
>   (defcustom custom-reset-button-menu nil
>     "If non-nil, only show a single reset button in customize buffers.
> --- 1240,1250 ----
>       (special-display-buffer-names nil)
>       (special-display-regexps nil)
>       (same-window-buffer-names nil)
> !     (same-window-regexps nil)
> !     (buffer (custom-get-fresh-buffer name)))
> !     (with-current-buffer buffer
> !       (custom-buffer-create-internal options description))
> !     (pop-to-buffer buffer)))
  
>   (defcustom custom-reset-button-menu nil
>     "If non-nil, only show a single reset button in customize buffers.

Those kinds of changes typically have the negative side effect that the
buffer-setup code (i.e. custom-buffer-create-internal in this case) can't
know the width of the window any more, so it can't fill text properly.

I general, we want to do the following:

- display the buffer in a window, so we know the properties of the window.
- fill the buffer with whatever text needs to be there, potentially using
  info about the window such as its width.
- re-adjust the window to the content of the buffer.

We could get away with a 2-step setup if we could do a "pop-to-buffer
dry-run" which would return some kind of "window prediction", i.e.:

- fill the buffer with whatever text needs to be there, potentially using
  things like (window-width (pop-to-buffer-dry-run (current-buffer))).
- call pop-to-buffer.

But note that pop-to-buffer-dry-run will sometimes have to return
a non-existent window because pop-to-buffer would create a new window.
That sounds nasty.


        Stefan




reply via email to

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