[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: Stefan Monnier
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 09:57:11 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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

The above should be changed so the whole code is surrounded by

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

That's a common need, so with-help-window should display the buffer
before running the code.

Of course, another way to look at it is that the buffer's content should
be independent from the window, and if it needs to be displayed
differently according to the window size, then this should be done
within the redisplay so that if that same buffer is displayed in several
windows, they all look "right".  But the current redisplay features
probably aren't sufficient for that.


reply via email to

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