From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#36894: Restore frameset focus and selectedness Date: Wed, 14 Aug 2019 23:50:44 +0300 Organization: LINKOV.NET Message-ID: <87tvajh3ob.fsf@mail.linkov.net> References: <878sscwovy.fsf@mail.linkov.net> <877e7rwbv7.fsf@mail.linkov.net> <834l2uconb.fsf@gnu.org> <874l2uug62.fsf@mail.linkov.net> <83y305btde.fsf@gnu.org> <87h86q8b3m.fsf@mail.linkov.net> <83a7ci9n4j.fsf@gnu.org> <87mugf4e8l.fsf@mail.linkov.net> <8336i6tolz.fsf@gnu.org> <87y2zw3gb8.fsf@mail.linkov.net> <12822045-5c5f-f575-8315-86a85657ecaa@gmx.at> <8336i3su1b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="149175"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 36894@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 14 23:00:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hy0NK-000cd0-WF for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Aug 2019 23:00:07 +0200 Original-Received: from localhost ([::1]:36070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hy0NJ-000893-T8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Aug 2019 17:00:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39085) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hy0LM-0005rH-R7 for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2019 16:58:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hy0LL-0001c0-Rc for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2019 16:58:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40979) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hy0LK-0001bA-Un for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2019 16:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hy0LK-0000vI-Sn for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2019 16:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Aug 2019 20:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36894 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36894-submit@debbugs.gnu.org id=B36894.15658162373482 (code B ref 36894); Wed, 14 Aug 2019 20:58:02 +0000 Original-Received: (at 36894) by debbugs.gnu.org; 14 Aug 2019 20:57:17 +0000 Original-Received: from localhost ([127.0.0.1]:49799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hy0Kb-0000u5-8P for submit@debbugs.gnu.org; Wed, 14 Aug 2019 16:57:17 -0400 Original-Received: from bisque.elm.relay.mailchannels.net ([23.83.212.18]:64433) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hy0KZ-0000tx-Jy for 36894@debbugs.gnu.org; Wed, 14 Aug 2019 16:57:16 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 776592C35FA; Wed, 14 Aug 2019 20:57:14 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a69.g.dreamhost.com (100-96-89-43.trex.outbound.svc.cluster.local [100.96.89.43]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id F0A642C3612; Wed, 14 Aug 2019 20:57:13 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a69.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.5); Wed, 14 Aug 2019 20:57:14 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Chemical-Coil: 6c6860860b5bb8ac_1565816234244_1868902066 X-MC-Loop-Signature: 1565816234244:22770396 X-MC-Ingress-Time: 1565816234244 Original-Received: from pdx1-sub0-mail-a69.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a69.g.dreamhost.com (Postfix) with ESMTP id 9526981F4D; Wed, 14 Aug 2019 13:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=WmlN8DIHZmDLBcPSERwng1pW0Gs=; b= oUezfZnOV9TjIc94Zr8hswaDLlJ8k4JMB1xwnxpgHJeCSPs6Puqt33LGOTA4VRav JFZDnoM7g9fURoLRfNpKdB0R8gvDhCPV2K+weZEx+Mjjl4HWmXbOM+XIzTSczytB guerZwYWohy6Ljy1mFpA03G0R3bWHozyTUYNLL+5k2Q= Original-Received: from mail.jurta.org (m91-129-109-163.cust.tele2.ee [91.129.109.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a69.g.dreamhost.com (Postfix) with ESMTPSA id 373BA81F58; Wed, 14 Aug 2019 13:57:05 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a69 In-Reply-To: <8336i3su1b.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Aug 2019 17:25:52 +0300") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddruddvledgledvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdelrdduieefnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtledrudeifedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegvlhhiiiesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164986 Archived-At: --=-=-= Content-Type: text/plain >> > The window manager always selects the last created frame, i.e. >> > it seems it's impossible to create a new frame without selecting it. >> >> The xfce window manager has an option for whether a new window should >> be automatically given focus or not. > > I'm not sure I understand what you both are saying. Are you saying > that this problem is impossible to solve in Emacs? The problem can be solved with this patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=frameset-restore-last-focus-frame.patch diff --git a/lisp/frameset.el b/lisp/frameset.el index 60b6fe38ad..4f7800630c 100644 --- a/lisp/frameset.el +++ b/lisp/frameset.el @@ -1346,6 +1352,16 @@ frameset-restore (error (delay-warning 'frameset (error-message-string err) :warning)))))) + ;; Make sure the last selected frame has focus. + (let ((last-focus-frame + (catch 'last-focus + (maphash (lambda (frame _) + (when (frame-parameter frame 'last-focus-update) + (throw 'last-focus frame))) + frameset--action-map)))) + (when last-focus-frame + (select-frame-set-input-focus last-focus-frame))) + ;; Make sure there's at least one visible frame. (unless (or (daemonp) (catch 'visible --=-=-=--