unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Juanma Barranquero <lekktu@gmail.com>,
	Chong Yidong <cyd@stupidchicken.com>,
	Emacs developers <emacs-devel@gnu.org>
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	[thread overview]
Message-ID: <4D7225C4.4080300@gmx.at> (raw)
In-Reply-To: <jwvzkpg2ox8.fsf-monnier+emacs@gnu.org>

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



  parent reply	other threads:[~2011-03-05 12:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1Ptqqn-0006fU-TE@internal.in.savannah.gnu.org>
2011-02-28  4:15 ` [Emacs-diffs] /srv/bzr/emacs/trunk r103444: * lisp/facemenu.el (list-colors-display): Use with-help-window (Bug#8048) Juanma Barranquero
2011-02-28  9:28   ` martin rudalics
2011-02-28 12:34     ` Juanma Barranquero
2011-02-28 14:57     ` Stefan Monnier
2011-02-28 17:10       ` martin rudalics
2011-02-28 18:39         ` Chong Yidong
2011-02-28 19:43           ` Eli Zaretskii
2011-02-28 19:58             ` Chong Yidong
2011-02-28 20:53               ` Johan Bockgård
2011-03-01  3:40                 ` Chong Yidong
2011-03-01  4:53                   ` Stefan Monnier
2011-03-01 18:51                     ` Eli Zaretskii
2011-03-02  8:09                       ` martin rudalics
2011-03-02 18:43                         ` Eli Zaretskii
2011-03-02 19:56                           ` martin rudalics
2011-03-04 17:49                         ` Tom Tromey
2011-03-05 12:00                           ` martin rudalics
2011-03-02 17:03                       ` Stefan Monnier
2011-03-02 18:51                         ` Eli Zaretskii
2011-03-01 21:43                     ` Chong Yidong
2011-03-01  9:47                   ` martin rudalics
2011-03-01 15:23                     ` Drew Adams
2011-03-01 17:43                       ` martin rudalics
2011-03-01 19:00                     ` Eli Zaretskii
2011-03-01 21:42                       ` Chong Yidong
2011-03-01 22:19                         ` Eli Zaretskii
2011-03-02  8:09                           ` martin rudalics
2011-03-02  0:13                         ` Juanma Barranquero
2011-03-02  8:09                           ` martin rudalics
2011-03-02  8:09                       ` martin rudalics
2011-02-28 20:57               ` Eli Zaretskii
2011-03-05 12:00       ` martin rudalics [this message]
2011-03-06  5:22         ` Stefan Monnier
2011-03-06  9:13           ` martin rudalics
2011-03-06 19:44             ` Stefan Monnier
2011-03-07 10:16               ` martin rudalics
2011-03-07 16:38                 ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4D7225C4.4080300@gmx.at \
    --to=rudalics@gmx.at \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).