[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list
From: |
martin rudalics |
Subject: |
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048). |
Date: |
Mon, 28 Feb 2011 10:28:04 +0100 |
User-agent: |
Thunderbird 2.0.0.21 (Windows/20090302) |
> Before this change
>
>> ------------------------------------------------------------
>> revno: 103444
>> committer: Chong Yidong <address@hidden>
>> branch nick: trunk
>> timestamp: Sun 2011-02-27 18:53:41 -0500
>> message:
>> * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048).
>> modified:
>> lisp/ChangeLog
>> lisp/facemenu.el
>
> emacs -Q -f temp-buffer-resize-mode -f list-color-display
>
> shows *Colors* in a window `temp-buffer-max-height' lines tall. After
> the change, the buffer is `window-min-height' lines tall.
What happens is that in the new code
(with-help-window buffer-name
(with-current-buffer standard-output
(erase-buffer)
(setq truncate-lines t)))
(let ((buf (get-buffer buffer-name))
(inhibit-read-only t))
;; Display buffer before generating content, to allow
;; `list-colors-print' to get the right window-width.
(with-selected-window (or (get-buffer-window buf t) (selected-window))
(with-current-buffer buf
(list-colors-print list callback)
(set-buffer-modified-p nil)))
(when callback
(pop-to-buffer buf)
(message "Click on a color to select it."))))
`with-help-window' eventually ends up calling `fit-window-to-buffer'
which, since the buffer is still empty at that time, makes the window
`window-min-height' lines tall. Unfortunately, we can't fill the buffer
_before_ calling `with-help-window' because, as the comment above
indicates, `list-colors-print' wants to know the width of the window
_before_ filling the buffer.
We could fix this, slightly hacky, by rewriting the last part as
;; Display buffer before generating content, to allow
;; `list-colors-print' to get the right window-width.
(with-selected-window (or (get-buffer-window buf t) (selected-window))
(with-current-buffer buf
(list-colors-print list callback)
(when temp-buffer-resize-mode
;; Take real buffer size into account when
;; `temp-buffer-resize-mode' is on.
(resize-temp-buffer-window))
(set-buffer-modified-p nil)))
Note that binding `temp-buffer-resize-mode' around the call to
`with-help-window' won't help - we'd have to remove
`resize-temp-buffer-window' from `temp-buffer-show-hook' which doesn't
strike me as elegant either.
martin
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Juanma Barranquero, 2011/02/27
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048).,
martin rudalics <=
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Juanma Barranquero, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Stefan Monnier, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., martin rudalics, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Chong Yidong, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Eli Zaretskii, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Chong Yidong, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Johan Bockgård, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Chong Yidong, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Stefan Monnier, 2011/02/28
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048)., Eli Zaretskii, 2011/02/28