all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30863: 27.0.50: more precise register-read-with-preview
@ 2018-03-19 20:00 Charles A. Roelli
  2018-07-16 18:58 ` bug#30863: close Charles A. Roelli
  0 siblings, 1 reply; 2+ messages in thread
From: Charles A. Roelli @ 2018-03-19 20:00 UTC (permalink / raw)
  To: 30863

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?





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#30863: close
  2018-03-19 20:00 bug#30863: 27.0.50: more precise register-read-with-preview Charles A. Roelli
@ 2018-07-16 18:58 ` Charles A. Roelli
  0 siblings, 0 replies; 2+ messages in thread
From: Charles A. Roelli @ 2018-07-16 18:58 UTC (permalink / raw)
  To: 30863

close 30863





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-16 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-19 20:00 bug#30863: 27.0.50: more precise register-read-with-preview Charles A. Roelli
2018-07-16 18:58 ` bug#30863: close Charles A. Roelli

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.