From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: fix for bug#29935 copyright-update inserts year at random places Date: Mon, 08 Jan 2018 10:56:59 -0600 Message-ID: <86o9m4gug4.fsf@stephe-leake.org> References: <868tdh5fag.fsf@stephe-leake.org> <837et0ckou.fsf@gnu.org> <86shbm4ks9.fsf@stephe-leake.org> <86k1wy48ch.fsf@stephe-leake.org> <861sj54wox.fsf@stephe-leake.org> <5A524604.6070909@gmx.at> <5A533F7D.4090505@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1515430529 32517 195.159.176.226 (8 Jan 2018 16:55:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 8 Jan 2018 16:55:29 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (windows-nt) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 08 17:55:24 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYahh-0007iW-Ap for ged-emacs-devel@m.gmane.org; Mon, 08 Jan 2018 17:55:17 +0100 Original-Received: from localhost ([::1]:45248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYajg-0007Uz-Tc for ged-emacs-devel@m.gmane.org; Mon, 08 Jan 2018 11:57:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYajV-0007TI-Ot for emacs-devel@gnu.org; Mon, 08 Jan 2018 11:57:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYajR-0001vF-O9 for emacs-devel@gnu.org; Mon, 08 Jan 2018 11:57:09 -0500 Original-Received: from smtp121.ord1d.emailsrvr.com ([184.106.54.121]:55762) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eYajR-0001sW-Jc for emacs-devel@gnu.org; Mon, 08 Jan 2018 11:57:05 -0500 Original-Received: from smtp8.relay.ord1d.emailsrvr.com (localhost [127.0.0.1]) by smtp8.relay.ord1d.emailsrvr.com (SMTP Server) with ESMTP id 66A6EC0060 for ; Mon, 8 Jan 2018 11:57:01 -0500 (EST) X-Auth-ID: board-president@tomahawk-creek-hoa.com Original-Received: by smtp8.relay.ord1d.emailsrvr.com (Authenticated sender: board-president-AT-tomahawk-creek-hoa.com) with ESMTPSA id 2AA93C0075 for ; Mon, 8 Jan 2018 11:57:01 -0500 (EST) X-Sender-Id: board-president@tomahawk-creek-hoa.com Original-Received: from Takver4 (76-218-37-33.lightspeed.kscymo.sbcglobal.net [76.218.37.33]) (using TLSv1.2 with cipher AES256-GCM-SHA384) by 0.0.0.0:25 (trex/5.7.12); Mon, 08 Jan 2018 11:57:01 -0500 In-Reply-To: (Stefan Monnier's message of "Mon, 08 Jan 2018 08:15:18 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 184.106.54.121 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221710 Archived-At: Stefan Monnier writes: >>> But this is a fairly normal/common need: display a buffer temporarily. >>> So we should have a "canned" answer. >>> I'm thinking of something like >>> >>> (let ((x (temporary-display-buffer BUF))) >> >> What kind of object would "x" be? > > The kind of object that carries the necessary information from > temporary-display-buffer to temporary-undisplay-buffer so that they > together DTRT. > >>> (temporary-undisplay-buffer x) >>> where hopefully this would handle the case where >>> temporary-display-buffer needs to use a separate frame, as well as the >>> case where BUF is already displayed somewhere. >> If "x" is a window, then `quit-restore-window' should know how to deal >> with it. > > If `x` is just a window, how does quit-restore-window know that we want > to hide BUF (and not some other buffer that happens to be displayed > in the window once we get to quit-restore-window)? > > If `x` is just a window, how does quit-restore-window know whether BUF was > already displayed in that window before temporary-undisplay-buffer was > called (in order to decide whether to change the window's buffer or not)? > >> So please tell what's missing in `with-temp-buffer-window'. > > It forces scoping. IOW it can't be used when the > temporary-undisplay-buffer part needs to be done at some arbitrary later > time (e.g. after the user has run a bunch of commands). In the context of `copyright-update-year', something like `save-frame-excursion' is what we want, at least given the current design. `with-temp-buffer-window' erases the buffer, and binds `standard-output' to it, which we certainly do not want. It uses `quit-restore-window', which looks useful, but I think it would work best in combination with a different way of displaying the buffer than `save-excursion pop-to-buffer'. Perhaps a new macro `with-temp-window' is what we want. This thread is nominally about patching emacs-26 to fix a bug. The patch I've posted is a minimal fix; adding code or redesigning to handle frames better is feature-creep, so it should be done on master. -- -- Stephe