[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: |
Sat, 05 Mar 2011 13:00:04 +0100 |
User-agent: |
Thunderbird 2.0.0.21 (Windows/20090302) |
> > 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.
Suppose we rewrote `with-output-to-temp-buffer' in Elisp then we would
probably come up with something like the following code:
(let ((standard-output buffer))
(setq value (progn ,@body)))
(with-current-buffer buffer
(set-buffer-modified-p nil)
(goto-char (point-min)))
(if (functionp temp-buffer-show-function)
(funcall temp-buffer-show-function buffer)
(let ((window (display-buffer buffer)))
(when window
;; Temporarily select window (and implicitly make the buffer
;; current).
(with-selected-window window
(setq minibuffer-scroll-window window)
(set-window-start window (point-min))
(set-window-point window (point))
(run-hooks 'temp-buffer-show-hook)))))
;; Return last value of BODY.
value))
If we now wanted to display the buffer _before_ evaluating BODY, we'd
have to splice in the evaluation into `temp-buffer-show-function'. I
don't have the slightest idea how this could be reasonably done :-(
martin
- Re: [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048).,
martin rudalics <=