unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35565: 27.0.50; gnus-summary-widget-forward error with other frame
@ 2019-05-04 18:05 Basil L. Contovounesios
  2019-05-05 20:03 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Basil L. Contovounesios @ 2019-05-04 18:05 UTC (permalink / raw)
  To: 35565; +Cc: Katsumi Yamaoka, Lars Ingebrigtsen

[-- Attachment #1: Type: text/plain, Size: 13 bytes --]

Tags: patch


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-Gnus-summary-widget-navigation-across-frames.patch --]
[-- Type: text/x-diff, Size: 3365 bytes --]

From 4190fec56ebd413e0e398d23edb55b89772ae1d0 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Sat, 4 May 2019 16:29:39 +0100
Subject: [PATCH] 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.
* 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 b8aa302f11..ac222acfd2 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -9423,8 +9423,11 @@ gnus-summary-widget-forward
   (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 @@ gnus-summary-widget-backward
   (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 5f7154c545..a992fe731c 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 @@ gnus-remove-some-windows
 	      (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)
 
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 1643 bytes --]


Since at least Emacs 24.4, the commands gnus-summary-widget-forward and
gnus-summary-widget-backward have been signalling an error in multiframe
configurations:

0. HOME=$(mktemp -d) emacs -Q
1. (progn (setq debug-on-error t
                gnus-select-method '(nntp "news.gwene.org"))
          (gnus-add-configuration
           '(article (frame 1.0
                            (summary 1.0 point frame-focus)
                            (article 1.0)))))
2. C-j
3. M-x gnus RET
4. s          [session only]
5. ^          [gnus-group-enter-server-mode]
6. n          [goto nntp:news.gwene.org]
7. RET        [gnus-server-read-server]
8. C-s gmane.emacs.devel RET
9. u          [gnus-browse-unsubscribe-current-group]
10. q         [gnus-browse-exit]
11. q         [gnus-server-exit]
12. RET 1 RET [gnus-group-select-group]
13. TAB       [gnus-summary-widget-forward]

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  select-window(nil)
  gnus-summary-widget-forward(1)
  funcall-interactively(gnus-summary-widget-forward 1)
  call-interactively(gnus-summary-widget-forward nil nil)
  command-execute(gnus-summary-widget-forward)

Is it okay to push the attached fix, which additionally simplifies the
subroutine gnus-get-buffer-window used by the two commands?

Thanks,

-- 
Basil

Gnus v5.13
In GNU Emacs 27.0.50 (build 14, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2019-05-04 built on thunk
Repository revision: b5376e0ebd7b62f00c1b64aef87cd8d96cfbc71a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description: Debian GNU/Linux buster/sid

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

* bug#35565: 27.0.50; gnus-summary-widget-forward error with other frame
  2019-05-04 18:05 bug#35565: 27.0.50; gnus-summary-widget-forward error with other frame Basil L. Contovounesios
@ 2019-05-05 20:03 ` Lars Ingebrigtsen
  2019-05-05 22:39   ` Basil L. Contovounesios
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-05-05 20:03 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: Katsumi Yamaoka, 35565

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Is it okay to push the attached fix, which additionally simplifies the
> subroutine gnus-get-buffer-window used by the two commands?

I have not tested the patch, but it does look reasonable to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#35565: 27.0.50; gnus-summary-widget-forward error with other frame
  2019-05-05 20:03 ` Lars Ingebrigtsen
@ 2019-05-05 22:39   ` Basil L. Contovounesios
  2019-05-12 11:54     ` Basil L. Contovounesios
  0 siblings, 1 reply; 4+ messages in thread
From: Basil L. Contovounesios @ 2019-05-05 22:39 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Katsumi Yamaoka, 35565

Lars Ingebrigtsen <larsi@gnus.org> writes:

> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> Is it okay to push the attached fix, which additionally simplifies the
>> subroutine gnus-get-buffer-window used by the two commands?
>
> I have not tested the patch, but it does look reasonable to me.

Thanks, I'll push in a few days if there are no objections before then.

-- 
Basil





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

* bug#35565: 27.0.50; gnus-summary-widget-forward error with other frame
  2019-05-05 22:39   ` Basil L. Contovounesios
@ 2019-05-12 11:54     ` Basil L. Contovounesios
  0 siblings, 0 replies; 4+ messages in thread
From: Basil L. Contovounesios @ 2019-05-12 11:54 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Katsumi Yamaoka, 35565-done

tags 35565 fixed
close 35565
quit

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>>
>>> Is it okay to push the attached fix, which additionally simplifies the
>>> subroutine gnus-get-buffer-window used by the two commands?
>>
>> I have not tested the patch, but it does look reasonable to me.
>
> Thanks, I'll push in a few days if there are no objections before then.

Done[1], so I'm closing this report.

[1: 571d802df3]: Fix Gnus summary widget navigation across frames
  2019-05-12 12:47:56 +0100
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=571d802df38cb1d3f93222f2977b766995616ac7

-- 
Basil





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

end of thread, other threads:[~2019-05-12 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-04 18:05 bug#35565: 27.0.50; gnus-summary-widget-forward error with other frame Basil L. Contovounesios
2019-05-05 20:03 ` Lars Ingebrigtsen
2019-05-05 22:39   ` Basil L. Contovounesios
2019-05-12 11:54     ` Basil L. Contovounesios

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).