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: recenter after visiting file (with savehist-mode) Date: Sun, 10 Feb 2019 16:50:12 +0100 Message-ID: <5C604834.1070501@gmx.at> References: 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="27270"; mail-complaints-to="usenet@blaine.gmane.org" To: =?UTF-8?B?SmFyb3PFgmF3IFJ6ZXN6w7N0a28=?= , "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 10 16:51:13 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 1gsrNw-0006xs-Pp for ged-emacs-devel@m.gmane.org; Sun, 10 Feb 2019 16:51:12 +0100 Original-Received: from localhost ([127.0.0.1]:60824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsrNv-0002mY-NB for ged-emacs-devel@m.gmane.org; Sun, 10 Feb 2019 10:51:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsrNG-0002lX-74 for emacs-devel@gnu.org; Sun, 10 Feb 2019 10:50:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gsrNE-0005L6-6G for emacs-devel@gnu.org; Sun, 10 Feb 2019 10:50:30 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:56707) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gsrN9-0004vP-SD for emacs-devel@gnu.org; Sun, 10 Feb 2019 10:50:26 -0500 Original-Received: from [192.168.1.101] ([213.162.73.34]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MLNeQ-1gtPbL3lxK-000gAU; Sun, 10 Feb 2019 16:50:14 +0100 In-Reply-To: X-Provags-ID: V03:K1:2OL9UubWSmtN9y0v6N9/b3AhSmBaeEeDiM11gMukR8sww303jUZ h/acHOsK1sKaR5ZBvRoVWxuJamwR76TEWJfKBo4kG5k4r3uuu9MQ+zbynY8y8Ss8P4BC2fZ jfga+7nesnk7H0frE7dEjMWxJGqYUgCi6QW4j9rUhQBU5ar+BiflnydsD9+ZBIt9ys99fwQ YDaqTnzZvySPidOx5xOnA== X-UI-Out-Filterresults: notjunk:1;V03:K0:VvFsUJuUbZ0=:B2IcevId2+3PnQq6/Al/rn 3I50iCLO+x82LA18KzGGSL4HpKJ4djW3q24NycUfXjOIhnuSkwDQ3GQsh10gbGVCzj4sxhesp gNIv5UuxMigdrNrNUUvSgGMR/UMFotbKgaNhdq/bL7k95Wf1b4qoT0Ylobly/dL8oLO9R4uh7 lbqvHwBIaOpz3r2tAl00mQ07jg/GTrcIfMWXDrPfKu+33BNW+OKE6BzMt+2GfDz13aw+2wRdM p4X6nVJfV1X8QTh+C7UgPz831myTEjHe2y3+EC6+zNxGsIAf09cRE7lqSoev7TNOJg7WwFN03 ctrRH2Y+1u0che0D+LspcpqcHnLilbvCt8W6+pJPLHSBkSDTntPOfRMgvEJhkqmeFmAR2MKqj y/TIod3uDCbDbY0J1da+oBH0mBf9CxhvoXtUvykU9ySpMJc5WqwPuxZgG3EjffsLp+ZrIafBZ xRim6wmGyo8XKGoAZOPQSi+s+diqRN5UFwbi5Vmar5cK3ZxKQahkMhzAiu1IR0HZ2rd6IgbfP mKpksITXdgjvOoS8uS4n/FAbaooiD33WX9dmym3PZzIJBl6rChPtwPkz838dQmNXRakt5vOPj wlfwqacTxeX3aOr7qsP+LHQydhm8EXhof2YqHl36u53y/+JphoHsWDRu9Me67YpT7yitUX1b9 neCsR2Z5M8V/fc6H98yUOvWryxMwRyJaurTIfoOgMNaxhdVrogZa6+H2KVffYnOFXV8Ygnzpy HvlsBYwWUFQBpRIvGFtWe30ccl+J5l9/NCCOVNVokkE3xZrPQzPzyhTLSYTDuFG/K+BZ+9x9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.22 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:233190 Archived-At: > I am trying to get Emacs to recenter the window around point after opening > a file with savehist-mode. I tried adding an :after advise to > save-place-find-file-hook, I tried setting a global display-buffer > function, but no matter what I try I keep getting the dreaded: > > `recenter'ing a window that does not display current-buffer. You probably have to use a function like the below. (defun recenter-window (&optional window) "Recenter WINDOW. WINDOW must be a live window and defaults to the selected one." (let ((window (window-normalize-window window t))) (if (eq window (selected-window)) (recenter) (with-selected-window window (recenter))))) martin