emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ement b429bbf567 2/2: Change: (ement-room-list) Reuse e


From: ELPA Syncer
Subject: [elpa] externals/ement b429bbf567 2/2: Change: (ement-room-list) Reuse existing window and select it
Date: Tue, 7 Mar 2023 19:58:05 -0500 (EST)

branch: externals/ement
commit b429bbf567856f77e2f4b5074cc85346fdf16094
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Change: (ement-room-list) Reuse existing window and select it
---
 README.org         |  4 +++-
 ement-room-list.el | 11 ++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index ce2fc5db00..d1605e45e0 100644
--- a/README.org
+++ b/README.org
@@ -291,7 +291,9 @@ Note that, while ~matrix-client~ remains usable, and 
probably will for some time
 
 ** 0.8-pre
 
-Nothing new yet.
+*Changes*
+
++ Command ~ement-room-list~ reuses an existing window showing the room list 
when possible.  ([[https://github.com/alphapapa/ement.el/issues/131][#131]].  
Thanks to [[https://github.com/jeffbowman][Jeff Bowman]] for suggesting.)
 
 ** 0.7
 
diff --git a/ement-room-list.el b/ement-room-list.el
index 35739f8619..3c734f7e0f 100644
--- a/ement-room-list.el
+++ b/ement-room-list.el
@@ -470,13 +470,13 @@ To be called from `ement-after-initial-sync-hook'."
 ;;;###autoload
 (cl-defun ement-room-list (&key (buffer-name "*Ement Room List*")
                                 (keys ement-room-list-default-keys)
-                                (display-buffer-action 
'(display-buffer-same-window))
+                                (display-buffer-action 
'((display-buffer-reuse-window display-buffer-same-window)))
                                 ;; visibility-fn
                                 )
   "Show a buffer listing Ement rooms, grouped with Taxy KEYS.
-The buffer is named BUFFER-NAME and is shown with
-DISPLAY-BUFFER-ACTION; or if DISPLAY-BUFFER-ACTION is nil, the
-buffer is not displayed."
+After showing it, its window is selected.  The buffer is named
+BUFFER-NAME and is shown with DISPLAY-BUFFER-ACTION; or if
+DISPLAY-BUFFER-ACTION is nil, the buffer is not displayed."
   (interactive)
   (let (format-table column-sizes window-start)
     (cl-labels (;; (heading-face
@@ -605,7 +605,8 @@ buffer is not displayed."
           (when (and section-ident (magit-get-section section-ident))
             (goto-char (oref (magit-get-section section-ident) start)))))
       (when display-buffer-action
-        (display-buffer buffer-name display-buffer-action))
+        (when-let ((window (display-buffer buffer-name display-buffer-action)))
+          (select-window window)))
       (when (get-buffer-window buffer-name)
         (set-window-start (get-buffer-window buffer-name) window-start))
       ;; NOTE: In order for `bookmark--jump-via' to work properly, the 
restored buffer



reply via email to

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