emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 94a16e7: Improve description of window configs in '


From: Charles A. Roelli
Subject: [Emacs-diffs] master 94a16e7: Improve description of window configs in 'register-val-describe'
Date: Mon, 16 Jul 2018 14:49:54 -0400 (EDT)

branch: master
commit 94a16e7360b69191001bc594ab1b66f2b6bf97c2
Author: Charles A. Roelli <address@hidden>
Commit: Charles A. Roelli <address@hidden>

    Improve description of window configs in 'register-val-describe'
    
    * etc/NEWS: Describe the change.
    * lisp/register.el (register-val-describe)
    [(window-configuration-p (car val))]: Include the shown
    buffers in the return value to make
    'register-read-with-preview' more useful.  (Bug#30863)
---
 etc/NEWS         |  4 ++++
 lisp/register.el | 15 ++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 2a93bdf..76c19ac 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -539,6 +539,10 @@ are obsoleted in GVFS.
 Tramp for some look-alike remote file names.
 
 ---
+** Register
+*** The return value of method 'register-val-describe' includes the
+names of buffers shown by the windows of a window configuration.
+
 ** The options.el library has been removed.
 It was obsolete since Emacs 22.1, replaced by customize.
 
diff --git a/lisp/register.el b/lisp/register.el
index 3d61044..e25f9fd 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -391,7 +391,20 @@ Interactively, reads the register using 
`register-read-with-preview'."
 (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."))



reply via email to

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