[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recenter after visiting file (with savehist-mode)

From: martin rudalics
Subject: Re: recenter after visiting file (with savehist-mode)
Date: Sun, 10 Feb 2019 16:50:12 +0100

> 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))
      (with-selected-window window


reply via email to

[Prev in Thread] Current Thread [Next in Thread]