GNU bug report logs - #66394
29.1; Make register-read-with-preview more useful

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thievol <at> posteo.net>

Date: Sat, 7 Oct 2023 19:07:01 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Thierry Volpiatto <thievol <at> posteo.net>
Cc: michael_heerdegen <at> web.de, dmitry <at> gutov.dev, Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>, 66394 <at> debbugs.gnu.org
Subject: bug#66394: 29.1; Make register-read-with-preview more useful
Date: Sun, 17 Dec 2023 18:20:56 -0500
> From 6a15a8b7b795b8377ef3537dc7bbd5ba26c0e159 Mon Sep 17 00:00:00 2001
> From: Thierry Volpiatto <thievol <at> posteo.net>
> Date: Thu, 14 Dec 2023 16:23:26 +0100
> Subject: [PATCH 3/4] Save and restore win confs after register commands
>
> When several windows are open, the register preview may eat other
> windows and break the current window configuration.
>
> * lisp/register.el (register-read-with-preview-fancy): Do it.
> ---
>  lisp/register.el | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lisp/register.el b/lisp/register.el
> index 8f0c6a7105d..1fadbe81056 100644
> --- a/lisp/register.el
> +++ b/lisp/register.el
> @@ -473,6 +473,7 @@ display such a window regardless."
>           (buffer1 "*Register quick preview*")
>           (buf (if register-use-preview buffer buffer1))
>           (pat "")
> +         (winconf (current-window-configuration))
>           (map (let ((m (make-sparse-keymap)))
>                  (set-keymap-parent m minibuffer-local-map)
>                  m))
> @@ -573,6 +574,7 @@ display such a window regardless."
>                        nil "No register specified")
>             (string-to-char result))
>        (when timer (cancel-timer timer))
> +      (set-window-configuration winconf)
>        (let ((w (get-buffer-window buf)))
>          (and (window-live-p w) (delete-window w)))
>        (and (get-buffer buf) (kill-buffer buf)))))

While save&restore of window configuration often works well, it
misbehaves in various cases (such as when the buffer is displayed in
another frame, which case case `set-window-configuration` will do you
no good).

The official way to undo a `display-buffer` is with
`quit-(restore-)window`.  See (info "(elisp)Quitting Windows").


        Stefan





This bug report was last modified 1 year and 209 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.