Björn Bidar <bjorn.bi...@thaodan.de> writes:

>>> * Preconditions
>>> - gnus-other-frame-object is a dead frame
>>
>> May you please describe when `gnus-other-frame-object' could become a
>> dead frame?
>
> I assume when  the frame that is in the object was closed.
>
> E.g. for example to trigger this state again I closed the Gnus frame I
> was writing this reply in.  Afterwards the frame is dead.

Then, why not simply the attached patch?

>From 73bb83c67dbda24c7b4455073482020b5e4e357b Mon Sep 17 00:00:00 2001
Message-ID: <73bb83c67dbda24c7b4455073482020b5e4e357b.1738513362.git.yanta...@posteo.net>
From: Ihor Radchenko <yanta...@posteo.net>
Date: Sun, 2 Feb 2025 17:20:50 +0100
Subject: [PATCH] ol-gnus: Do not err when gnus frame is dead
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/ol-gnus.el (org-gnus-follow-link): Do not try to switch to dead
frame.

Reported-by: Björn Bidar <bjorn.bi...@thaodan.de>
Link: https://list.orgmode.org/orgmode/87o6zn4m40.fsf@/
---
 lisp/ol-gnus.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ol-gnus.el b/lisp/ol-gnus.el
index 5cddc3790a..ac2cadbc66 100644
--- a/lisp/ol-gnus.el
+++ b/lisp/ol-gnus.el
@@ -228,7 +228,9 @@ (defun org-gnus-follow-link (&optional group article)
   "Follow a Gnus link to GROUP and ARTICLE."
   (require 'gnus)
   (funcall (org-link-frame-setup-function 'gnus))
-  (when gnus-other-frame-object (select-frame gnus-other-frame-object))
+  (when (and gnus-other-frame-object
+             (frame-live-p gnus-other-frame-object))
+    (select-frame gnus-other-frame-object))
   (let ((group (org-no-properties group))
 	(article (org-no-properties article)))
     (cond
-- 
2.47.1

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to