bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#30863: 27.0.50: more precise register-read-with-preview


From: Charles A. Roelli
Subject: bug#30863: 27.0.50: more precise register-read-with-preview
Date: Mon, 19 Mar 2018 21:00:16 +0100

The following change makes register-read-with-preview more precise
with respect to window configurations:


diff --git a/lisp/register.el b/lisp/register.el
index 77d84c0..e5aef58 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -390,7 +390,20 @@ describe-register-1
 (cl-defmethod register-val-describe ((val cons) verbose)
   (cond
    ((window-configuration-p (car val))
-    (princ "a window configuration."))
+    (let* ((stored-window-config (car val))
+           (window-config-frame (window-configuration-frame 
stored-window-config))
+           (current-frame (selected-frame)))
+      (princ (format "a window configuration: %s."
+                     (if (frame-live-p window-config-frame)
+                         (with-selected-frame window-config-frame
+                           (save-window-excursion
+                             (set-window-configuration stored-window-config)
+                             (concat
+                              (mapconcat (lambda (w) (buffer-name 
(window-buffer w)))
+                                         (window-list (selected-frame)) ", ")
+                              (unless (eq current-frame window-config-frame)
+                                " in another frame"))))
+                       "dead frame")))))
 
    ((frame-configuration-p (car val))
     (princ "a frame configuration."))


For example, after typing "C-x r w a", then "C-x r j" in a frame with
three windows, the register preview will now show something like this,

  a: window configuration: *Messages*, *scratch*, *GNU Emacs*

instead of just

  a: window configuration.

It also tells whether the window configuration points to a dead frame
or a frame besides the selected one.

It would be a cleaner solution if we could easily extract the list of
buffers from any given window configuration (rather than temporarily
setting the configuration and iterating through the window-list as
above).  Does anyone know how to do that?





reply via email to

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