Before `window-configuration-to-register' +-------------------+-----------------+ | | | | | | | | | | | | +-------------------+-----------------+ After `window-configuration-to-register' +-------------------------------------+ | | | | | | | | +-------------------------------------+ Then last (wrong) window configuration is saved to register. ``` (defun register-read-with-preview (prompt) ... (let ((w (get-buffer-window buffer))) (and (window-live-p w) (delete-window w))) <=== ### Don't check pre existing window ### (and (get-buffer buffer) (kill-buffer buffer))))) ``` Thanks. Best regards. In GNU Emacs 27.0.91 (build 4, x86_64-pc-linux-gnu, cairo version 1.16.0) of 2020-05-06 built on Ubuntu-18 Repository revision: f8e6cd11b34320999aa72886ece3f32b0a8ad897 Repository branch: emacs-27 Windowing system distributor 'The X.Org Foundation', version 11.0.12005000 System Description: Ubuntu 19.10 Configured using: 'configure --with-cairo --with-x-toolkit=no CFLAGS=-O3' Configured features: XPM JPEG TIFF GIF PNG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ ZLIB OLDXMENU X11 XDBE XIM MODULES THREADS PDUMPER GMP Important settings: value of $LC_ALL: value of $LANG: es_ES.UTF-8 locale-coding-system: utf-8 Date: Wed, 06 May 2020 13:11:21 +0200 Message-ID: <87zhalgvxi.fsf@Ubuntu-18.i-did-not-set--mail-host-address--so-tickle-me>