emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 571d802: Fix Gnus summary widget navigation across


From: Basil L. Contovounesios
Subject: [Emacs-diffs] master 571d802: Fix Gnus summary widget navigation across frames
Date: Sun, 12 May 2019 07:51:46 -0400 (EDT)

branch: master
commit 571d802df38cb1d3f93222f2977b766995616ac7
Author: Basil L. Contovounesios <address@hidden>
Commit: Basil L. Contovounesios <address@hidden>

    Fix Gnus summary widget navigation across frames
    
    * lisp/gnus/gnus-sum.el (gnus-summary-widget-forward)
    (gnus-summary-widget-backward): Signal more informative error if
    article window is not found.  Consider other frames displaying
    article buffer, and raise its frame before navigating its
    widgets. (bug#35565)
    * lisp/gnus/gnus-win.el (gnus-get-buffer-window): Simplify and add
    docstring.
---
 lisp/gnus/gnus-sum.el | 18 ++++++++++++------
 lisp/gnus/gnus-win.el | 19 ++++++++++---------
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index b8aa302..ac222ac 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -9423,8 +9423,11 @@ With optional ARG, move across that many fields."
   (interactive "p")
   (gnus-summary-select-article)
   (gnus-configure-windows 'article)
-  (select-window (gnus-get-buffer-window gnus-article-buffer))
-  (widget-forward arg))
+  (let ((win (or (gnus-get-buffer-window gnus-article-buffer t)
+                 (error "No article window found"))))
+    (select-window win)
+    (select-frame-set-input-focus (window-frame win))
+    (widget-forward arg)))
 
 (defun gnus-summary-widget-backward (arg)
   "Move point to the previous field or button in the article.
@@ -9432,10 +9435,13 @@ With optional ARG, move across that many fields."
   (interactive "p")
   (gnus-summary-select-article)
   (gnus-configure-windows 'article)
-  (select-window (gnus-get-buffer-window gnus-article-buffer))
-  (unless (widget-at (point))
-    (goto-char (point-max)))
-  (widget-backward arg))
+  (let ((win (or (gnus-get-buffer-window gnus-article-buffer t)
+                 (error "No article window found"))))
+    (select-window win)
+    (select-frame-set-input-focus (window-frame win))
+    (unless (widget-at (point))
+      (goto-char (point-max)))
+    (widget-backward arg)))
 
 (defun gnus-summary-isearch-article (&optional regexp-p)
   "Do incremental search forward on the current article.
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
index 5f7154c..a992fe7 100644
--- a/lisp/gnus/gnus-win.el
+++ b/lisp/gnus/gnus-win.el
@@ -28,6 +28,7 @@
 
 (require 'gnus)
 (require 'gnus-util)
+(require 'seq)
 
 (defgroup gnus-windows nil
   "Window configuration."
@@ -509,15 +510,15 @@ should have point."
              (delq lowest-buf bufs)))))
 
 (defun gnus-get-buffer-window (buffer &optional frame)
-  (cond ((and (null gnus-use-frames-on-any-display)
-             (memq frame '(t 0 visible)))
-        (car
-         (let ((frames (frames-on-display-list)))
-           (seq-remove (lambda (win) (not (memq (window-frame win)
-                                                    frames)))
-                           (get-buffer-window-list buffer nil frame)))))
-       (t
-        (get-buffer-window buffer frame))))
+  "Return a window currently displaying BUFFER, or nil if none.
+Like `get-buffer-window', but respecting
+`gnus-use-frames-on-any-display'."
+  (if (and (not gnus-use-frames-on-any-display)
+           (memq frame '(t 0 visible)))
+      (let ((frames (frames-on-display-list)))
+        (seq-find (lambda (win) (memq (window-frame win) frames))
+                  (get-buffer-window-list buffer nil frame)))
+    (get-buffer-window buffer frame)))
 
 (provide 'gnus-win)
 



reply via email to

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