From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel 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 Message-ID: References: <4D6B6AA4.8090008@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1298905774 24565 80.91.229.12 (28 Feb 2011 15:09:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 28 Feb 2011 15:09:34 +0000 (UTC) Cc: Juanma Barranquero , Chong Yidong , Emacs developers To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 28 16:09:29 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pu4j0-0003G6-Ov for ged-emacs-devel@m.gmane.org; Mon, 28 Feb 2011 16:09:26 +0100 Original-Received: from localhost ([127.0.0.1]:32894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pu4XT-0005Ui-Ic for ged-emacs-devel@m.gmane.org; Mon, 28 Feb 2011 09:57:31 -0500 Original-Received: from [140.186.70.92] (port=52793 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pu4XE-0005RV-3q for emacs-devel@gnu.org; Mon, 28 Feb 2011 09:57:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pu4XB-0004LG-5y for emacs-devel@gnu.org; Mon, 28 Feb 2011 09:57:14 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:33670 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pu4XB-0004L5-3l for emacs-devel@gnu.org; Mon, 28 Feb 2011 09:57:13 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAE5Ga01FxKsT/2dsb2JhbACmRXW8H4VhBIUQj18 X-IronPort-AV: E=Sophos;i="4.62,240,1297054800"; d="scan'208";a="93789604" Original-Received: from 69-196-171-19.dsl.teksavvy.com (HELO ceviche.home) ([69.196.171.19]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 28 Feb 2011 09:57:12 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id CB86E660D6; Mon, 28 Feb 2011 09:57:11 -0500 (EST) In-Reply-To: <4D6B6AA4.8090008@gmx.at> (martin rudalics's message of "Mon, 28 Feb 2011 10:28:04 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136599 Archived-At: > 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 with-help-window. > 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. Stefan