From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: find-file-hook, recenter, scroll-conservatively and save-place Date: Fri, 01 Feb 2019 10:04:47 +0100 Message-ID: <5C540BAF.3000602@gmx.at> References: <877eelupkc.fsf@errge.nilcons.com> <5C52FCDD.7010803@gmx.at> <878sz0o9nd.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="148008"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Gergely Risko , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 01 10:07:10 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 1gpUn0-000cP9-Mu for ged-emacs-devel@m.gmane.org; Fri, 01 Feb 2019 10:07:10 +0100 Original-Received: from localhost ([127.0.0.1]:41081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpUmz-0006mv-Ik for ged-emacs-devel@m.gmane.org; Fri, 01 Feb 2019 04:07:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpUlE-0006Gm-7K for emacs-devel@gnu.org; Fri, 01 Feb 2019 04:05:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpUlD-0000LE-9F for emacs-devel@gnu.org; Fri, 01 Feb 2019 04:05:20 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:35713) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gpUlB-0000H6-7J for emacs-devel@gnu.org; Fri, 01 Feb 2019 04:05:17 -0500 Original-Received: from [192.168.1.101] ([212.95.5.163]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MILxX-1grPd63uHf-004BFJ; Fri, 01 Feb 2019 10:05:00 +0100 In-Reply-To: <878sz0o9nd.fsf@mail.linkov.net> X-Provags-ID: V03:K1:IK9gHUFGxrX/V02NmpU9DF1lVhqEJPlklZICaBNzAztKn7ZvJuy vRtlpLoDe6L2CxPs4cX9VVuqMb7Fd+czq7C4izmXIhtpK5zPnpbn3YOxmPjPcToHDxXcQ+1 5dAbNHRf+qBR6Zu+qu3ZoJerALz5I0lgQ/06ZTLT4ZlMFU5tuCBd34qpNKsIjeZFfr06+2V gS0ZOjJ7xuY9jcHfa71kg== X-UI-Out-Filterresults: notjunk:1;V03:K0:BfLNwPMcs6M=:Gs/nsve1l9AQC8CsbPe7t6 lvjR/zxapeBtWsHo+Uk1CcQxdyYJkinq4xkw5dFrmReKJyZYK+S3atwT9Hjn7KcLxo0hZIvTF uTn/r98YjrX1mCCJ6DwT7afduMINFLGT+xvYn0oaPMjZ5iPQbRUTWPlQS7rJZuYRUSnZLMFFH OvwT+A82TDkJ27tPchQuDSofp4c/j10brgJyHvIWvhOHDcfoQAV5p79zljsOmNc8jRh3IQvrQ iFdktHmdYe79orxoKeFVv7oZKsTKcO3+cd2MnPHvxr0YzkdSHdQZEqia0SUm0MB7OeflLDX1+ w9yk8lgxM/LawaXLkSMoY5ZjN+da7/PgpVLSjhYlsjpQVSzc2yezzO5siZ/3SZ2EJjpYaKluC IABho5Ie9C1I1665MG3ThKG1MSccgucezRcqUzwBgzEOJnQT1jKwiohjZX6k+ovltORDjjpo5 Y46Gr8Rnj5C6HD0WfzXSyxkSGCs4NwqrRDj5+ieMftRSj+c8/0OwE9ioNJJLZS34Gnalrr95i VlDX8Pw7u11tO0heGNQro4LrZfCKTmCK0J7q/+VcCGskWn9t9Z8WpkAfLqlb19pD2CpfgO5nE Z7YzJ/92ShYv5wmYF/IgJmVWNcIWi7ryaipsMTQtOQtbCu8bgrpyBgqLPmayEG2cXydrKaJ+H AHneUcDV4hfGEhwo6YAgUwVZ5IPZ9nFZiHttf8RgrTtxeMGkdhUATORY17gYNqkeONHhSAkMl EvhmSqJvcXFZ8OT3nb3T+0GmfLW7lishd17/6yRis0uDZ9nzT5L6DUrG/kW6GE5B9VK5IhKi X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.19 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:232881 Archived-At: > I don't like the default recentering too. I had to fix it with > a lot of customization, e.g. > > (add-hook 'xref-after-jump-hook 'reposition-window) > (add-hook 'xref-after-return-hook 'reposition-window) > (add-hook 'find-function-after-hook 'reposition-window) Once you get used to recentering you probably like it. I never managed to like it. It's a consequence of our insistence to keep point on-screen. >> That is, provide 'window-point' and 'window-start' action alist entries >> with the former allowing the 'switch-to-buffer-preserve-window-point' >> logic (among others) and the latter optionally allowing to recenter. > > Like switch-to-buffer-preserve-window-point used in dired-find-file? More like we handle 'display-buffer-mark-dedicated' now. That is, 'switch-to-buffer-preserve-window-point' would be respected by 'display-buffer' unless explicitly overridden by a 'window-point' entry. But I dislike the idea of adding yet another variable that will be eventually handled like an alist entry. > 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. Basically, anyone who wants to customize the behavior may bind 'display-buffer-alist' appropriately around the 'find-file' call. But this is awkward. Alists are not very suitable to "affect just this 'display-buffer' 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 have no practice with 'save-place-mode' so I can't tell. From my experience I can only tell that it's disorienting when reverting a buffer doesn't preserve window start. martin