unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: martin rudalics <rudalics@gmx.at>
Cc: 25521@debbugs.gnu.org, qwxlea@gmail.com
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	[thread overview]
Message-ID: <87bmmu7czr.fsf@users.sourceforge.net> (raw)
In-Reply-To: <59A95A75.8040100@gmx.at> (martin rudalics's message of "Fri, 01 Sep 2017 15:02:45 +0200")

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

martin rudalics <rudalics@gmx.at> 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)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1157 bytes --]

From c31a39c300e32af1f9b810e92065208eb1b5c2f3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
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)))
 
 \f
 ;;;; Background mode.
-- 
2.14.1


  reply	other threads:[~2017-09-01 13:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24 21:05 bug#25521: 26.0.50; After (make-frame '((name . "foo"))) (select-frame-by-name "foo") doesn't see the frame Alex 'QWxleA' Poslavsky
2017-01-24 23:35 ` npostavs
2017-01-25  3:37   ` Eli Zaretskii
2017-01-25  3:31 ` Eli Zaretskii
2017-01-25  6:47   ` Alex (QWxleA)
2017-01-25 23:43     ` npostavs
2017-01-26 11:40       ` Alex (QWxleA)
2017-01-26 14:37         ` npostavs
2017-01-26 15:48           ` Alex (QWxleA)
2017-01-27  2:02             ` npostavs
2017-01-27  7:56               ` Eli Zaretskii
2017-06-30  3:08                 ` npostavs
2017-06-30  6:09                   ` Eli Zaretskii
2017-06-30  6:52                   ` martin rudalics
2017-09-01  3:13                     ` npostavs
2017-09-01  6:56                       ` Eli Zaretskii
2017-09-01 13:02                       ` martin rudalics
2017-09-01 13:41                         ` npostavs [this message]
2017-09-01 15:45                           ` martin rudalics
2017-09-26  2:54                             ` Noam Postavsky
2017-09-27  8:11                               ` martin rudalics
2017-09-27 12:13                                 ` Noam Postavsky
2017-09-29  8:33                                   ` martin rudalics
2017-09-29 12:48                                     ` Noam Postavsky
2017-09-29 18:19                                       ` martin rudalics
2017-09-29 22:47                                         ` Noam Postavsky
2017-09-29 13:39                                 ` Eli Zaretskii
2017-10-14  2:14                                 ` Noam Postavsky
2017-10-14  8:36                                   ` martin rudalics
2017-10-15 18:22                                     ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmmu7czr.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=25521@debbugs.gnu.org \
    --cc=qwxlea@gmail.com \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).