[Top][All Lists]

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

bug#25521: 26.0.50; After (make-frame '((name . "foo"))) (select-frame-b

From: npostavs
Subject: bug#25521: 26.0.50; After (make-frame '((name . "foo"))) (select-frame-by-name "foo") doesn't see the frame
Date: Fri, 01 Sep 2017 09:41:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

martin rudalics <address@hidden> writes:

> I'm not very convinced.  First, the present bug should not motivate this
> change.  ‘select-frame-by-name’ is a pretty obscure function.  It fails
> in the OP's case because the display info for the new frame has not been
> yet set up.  In the interactive call, suggesting a default frame on the
> current terminal makes sense; so consulting that info is useful.  But
> the info is useless in a non-interactive call: Nothing should prevent
> that function from selecting a frame with a given name on any display.

Ah, so we could just do something like this? (untested)

>From c31a39c300e32af1f9b810e92065208eb1b5c2f3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Fri, 1 Sep 2017 09:38:55 -0400
Subject: [PATCH v2] Let select-frame-by-name choose any frame when called from
 lisp (Bug#25521)

* lisp/frame.el (select-frame-by-name): Choose from the whole list of
frames in the non-interactive part.
 lisp/frame.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lisp/frame.el b/lisp/frame.el
index 2a14302e9f..e8b7c82cbb 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -905,11 +905,12 @@ select-frame-by-name
      (if (= (length input) 0)
         (list default)
        (list input))))
-  (let* ((frame-names-alist (make-frame-names-alist))
-        (frame (cdr (assoc name frame-names-alist))))
-    (if frame
-       (select-frame-set-input-focus frame)
-      (error "There is no frame named `%s'" name))))
+  (catch 'done
+    (dolist (frame (frame-list))
+      (when (equal (frame-parameter frame 'name) name)
+        (select-frame-set-input-focus frame)
+        (throw 'done t)))
+    (error "There is no frame named `%s'" name)))
 ;;;; Background mode.

reply via email to

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