]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix window setting in register preview (bug#67882)
authorThierry Volpiatto <thievol@posteo.net>
Tue, 26 Dec 2023 16:49:34 +0000 (17:49 +0100)
committerThierry Volpiatto <thievol@posteo.net>
Wed, 10 Jan 2024 16:02:52 +0000 (17:02 +0100)
and allow configuring it if needed.

* lisp/register.el (register-preview-display-buffer-alist): New user
  var.
(register-preview,register-preview-1): Use it.

lisp/register.el

index baad2c2a05de9dd0fe8dae35adef6e7bfd7e4eb8..f5b0365dec23d85b45a2af13679eeff3a92418f8 100644 (file)
@@ -386,18 +386,21 @@ Format of each entry is controlled by the variable `register-preview-function'."
     (setq register-preview-function (register--preview-function
                                      register--read-with-preview-function)))
   (when (or show-empty (consp register-alist))
-    (with-current-buffer-window
-     buffer
-     (cons 'display-buffer-below-selected
-          '((window-height . fit-window-to-buffer)
-            (preserve-size . (nil . t))))
-     nil
-     (with-current-buffer standard-output
-       (setq cursor-in-non-selected-windows nil)
-       (mapc (lambda (elem)
-               (when (get-register (car elem))
-                 (insert (funcall register-preview-function elem))))
-             register-alist)))))
+    (with-current-buffer-window buffer
+        register-preview-display-buffer-alist
+        nil
+      (with-current-buffer standard-output
+        (setq cursor-in-non-selected-windows nil)
+        (mapc (lambda (elem)
+                (when (get-register (car elem))
+                  (insert (funcall register-preview-function elem))))
+              register-alist)))))
+
+(defcustom register-preview-display-buffer-alist '(display-buffer-at-bottom
+                                                   (window-height . fit-window-to-buffer)
+                                                  (preserve-size . (nil . t)))
+  "Window configuration for the register preview buffer."
+  :type display-buffer--action-custom-type)
 
 (defun register-preview-1 (buffer &optional show-empty types)
   "Pop up a window showing the preview of registers in BUFFER.
@@ -415,9 +418,7 @@ Format of each entry is controlled by the variable `register-preview-function'."
     (when (or show-empty (consp registers))
       (with-current-buffer-window
         buffer
-        (cons 'display-buffer-below-selected
-             '((window-height . fit-window-to-buffer)
-               (preserve-size . (nil . t))))
+        register-preview-display-buffer-alist
         nil
         (with-current-buffer standard-output
           (setq cursor-in-non-selected-windows nil)