From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Gergely Risko Newsgroups: gmane.emacs.devel Subject: Re: find-file-hook, recenter, scroll-conservatively and save-place Date: Thu, 31 Jan 2019 23:45:49 +0100 Message-ID: <87r2cstpia.fsf@errge.nilcons.com> References: <877eelupkc.fsf@errge.nilcons.com> <5C52FCDD.7010803@gmx.at> <878sz0o9nd.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="53996"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: GNU Emacs with Gnus To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 31 23:47:03 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpL6r-000Du1-HJ for ged-emacs-devel@m.gmane.org; Thu, 31 Jan 2019 23:47:01 +0100 Original-Received: from localhost ([127.0.0.1]:34021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpL6q-00054N-HE for ged-emacs-devel@m.gmane.org; Thu, 31 Jan 2019 17:47:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpL5w-00053N-MG for emacs-devel@gnu.org; Thu, 31 Jan 2019 17:46:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpL5v-0000qs-Uc for emacs-devel@gnu.org; Thu, 31 Jan 2019 17:46:04 -0500 Original-Received: from [195.159.176.226] (port=54764 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gpL5v-0000qW-O5 for emacs-devel@gnu.org; Thu, 31 Jan 2019 17:46:03 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1gpL5s-000D0B-RU for emacs-devel@gnu.org; Thu, 31 Jan 2019 23:46:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:8dN1k39L61mwKeQEe29DVkKbBPI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 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:232871 Archived-At: On 2019-01-31 22:57 (Thursday), Juri Linkov writes: > Interesting question. Maybe introduce two new buffer-local variables > 'window-point' and 'window-start' that a hook could set and then > display-buffer could read and call functions window-point and window-start? > These buffer-local values should be used only once and should be reverted > to nil after the first use. I start to understand the approach proposed by you and Martin. This buffer-local variable approach feels natural and OK to me. Martin also said this: >> When 'display-buffer' finds a '(window-start . recenter) ALIST entry >> it would call 'recenter' after assigning the window buffer. Just one point to this: should we have '(window-start . (recenter 10)) also, where 10 is the ARG for the future recenter call? > BTW, a related question: should save-place save window-start as well? > It should be easy to implement after this problem is solved. I think that would be nice and there is only one corner case I think we have to take care of: recentf is a long term operation compared to switch-to-buffer-preserve-window-point in the sense that when the user comes back after days maybe he is sitting in front of a different sized screen with differently configured frames and windows. Therefore we have to give precedence to the point and take the window-start recommendation of save-place with a grain of salt. As far as I can understand it now, fortunately this is done for us already by redisplay for free. Gergely