From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tom Gillespie Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Fix display-buffer-use-some-window to honor reusable-frames Date: Sun, 29 Jan 2023 14:02:42 -0500 Message-ID: References: <834jsccepb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000eddf0a05f36bbe92" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37593"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org, larsi@gnus.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 29 20:03:33 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pMCxh-0009dp-Fo for ged-emacs-devel@m.gmane-mx.org; Sun, 29 Jan 2023 20:03:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMCxB-0001oM-JV; Sun, 29 Jan 2023 14:03:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMCx8-0001m8-2D for emacs-devel@gnu.org; Sun, 29 Jan 2023 14:02:58 -0500 Original-Received: from mail-yb1-xb31.google.com ([2607:f8b0:4864:20::b31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pMCx6-0003DG-0F; Sun, 29 Jan 2023 14:02:57 -0500 Original-Received: by mail-yb1-xb31.google.com with SMTP id c124so11670194ybb.13; Sun, 29 Jan 2023 11:02:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5dI8piqpyTNAETKRHMpcn+SijvXdTxXQOEk3siFOiDQ=; b=QDZG14PY1f87Vrxu+CZjPYv8WDnvVJjW9DNW8Sn8OF8w2ijdFMXIWqxAJ/KaCafH1C jAf5ng1vlvIbRrKyirvjO+USCnrDceQ6y8gcll1SVPWY2r1PWAtEtiKLvDLCP3nF6oR0 wt4AmeUjmdQYTZdktripUVeqUq5Fcgz5vZLqoaoucitXF8waMuQvnTRHEV87k3B2Uizb Yio1oNkCvSUzgd9Q260hlVetxkTd/RDVUAZJv4iO/5OC7/Lo9hRjT4o1Dr58+zF9nGIk 1td04lAYoYmhwVcWDyoQ3GjtFmn6VxaHHNx6YbxcM0soBYLotqPppdKUCowo3fs12jPI xEmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5dI8piqpyTNAETKRHMpcn+SijvXdTxXQOEk3siFOiDQ=; b=z56VKiz29Wu12ofy9ehXJldPPowaK5LCLB9oongeA9J6BlaTgUaqJxaDdcnnzGGFK9 UBftuMCY5sl5ZJaXsTq+SwjlkY0qXrCaWC0PBUWEQusy91dLvVX+CzAFpEmovkgx+bad nQNik45wcU143h5xhm934Vf6yDtW2ljuYkN3zAaHO41Kv7Mg7J7JWNEcu91wuwJCtdA/ hOHZQbRrkP1TmEArQhId7P0HZ0p6zJ96sDMSyIhffZfcWonoIJ2qy38oud8No2OmIhHJ +ixdNkoBtuGDmMMki6pzlsj7P/O2UGo5NLzT+Mdup5Wshq7V0u5zuj49UJ5+uo+EExN0 BLLA== X-Gm-Message-State: AFqh2koUIMaoVGTcZS0p2Z2Kao9zzbduc+3/GJ7l0bN5iXji5Tgen8wp rku6i4GPcL+zFrn8zFzy56GpbXnLBpoOWsIM8u8= X-Google-Smtp-Source: AMrXdXvpQVHzNXwZ4ceVEQcDsCIja2ESCm2VlLkwCpXbs+4+xkGrlUKE6MfBBZDwdGOW+Kr0ION5DEW/A5JYrzCjP/4= X-Received: by 2002:a25:4807:0:b0:7ca:63c4:e5c1 with SMTP id v7-20020a254807000000b007ca63c4e5c1mr4553326yba.301.1675018973844; Sun, 29 Jan 2023 11:02:53 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::b31; envelope-from=tgbugs@gmail.com; helo=mail-yb1-xb31.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302759 Archived-At: --000000000000eddf0a05f36bbe92 Content-Type: text/plain; charset="UTF-8" Here is an updated patch to address Martin's comments. More responses in line. Best! Tom > + (window (get-buffer-window buffer reusable-frames))))) > > Here the last line gets me Argh. Yep, a copy/paste error out of a let form. Given your question below I've rethought the issue, and now pass reusable-frames to get-lru-window instead, which produces the expected lru behavior when searching for a window over multiple frames. > Now if this frame contains more than one window, 'get-lru-window' will > usually (barring not fullwidth, dedicated ... windows) always succeed in > finding a window. This is probably not the intended behavior if this > frame contains a reusable window - one that shows BUFFER already. Maybe > you think that some other action function would handle that. But then > why would you want to handle 'reusable-frames' here at all? The reason I handle reusable-frames here is so that if a user wants to search other frames for the least recently used window (e.g. they have 3 visible frames, one for each monitor, and they want the lru window to be selected from any of those visible frames). The implementation of this in that old patch was completely incorrect. In the new version reusable-frames is passed to get-lru-window, which produces the expected results. > Also 'display-buffer-pop-up-window' is an action function which returns > a window _and_ displays the buffer in it. Resolved so that we don't try to display the buffer twice. > This > > + (prog1 > > has been cargo-culted from 'display-buffer-use-some-window'. It's of no > use here because you return the window used below. Now gone. > Finally, please fix the doc-string so it tells what this function really > does (and please leave two spaces between sentences). Done --000000000000eddf0a05f36bbe92 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-display-buffer-use-least-recent-window-to-split-.patch" Content-Disposition: attachment; filename="0001-Fix-display-buffer-use-least-recent-window-to-split-.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ldhr0cbb0 RnJvbSAyNmZiYWQyYmNmN2NhYmY5ODY3OGRkYTAwOTUzMzRmYWI3NzIyNDgwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUb20gR2lsbGVzcGllIDx0Z2J1Z3NAZ21haWwuY29tPgpEYXRl OiBUaHUsIDI2IEphbiAyMDIzIDIzOjQ3OjIyIC0wNTAwClN1YmplY3Q6IFtQQVRDSF0gRml4IGRp c3BsYXktYnVmZmVyLXVzZS1sZWFzdC1yZWNlbnQtd2luZG93IHRvIHNwbGl0LCByZXR1cm4KIHdp bmRvdy4KCiogbGlzcC93aW5kb3cuZWwgKGRpc3BsYXktYnVmZmVyLXVzZS1sZWFzdC1yZWNlbnQt d2luZG93KTogUmV0dXJuCndpbmRvdyBpbnN0ZWFkIG9mIG5pbCwgYW5kIGFjdHVhbGx5IHNwbGl0 IGluIHNpbmdsZSB3aW5kb3cgY2FzZS4KCidkaXNwbGF5LWJ1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b3cgKGRpc3BsYXktYnVmZmVyLXVz ZS1zb21lLXdpbmRvdwotICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlciAoY29ucyAoY29ucyAn aW5oaWJpdC1zYW1lLXdpbmRvdyB0KSBhbGlzdCkpKSkKLSAgICAod2luZG93LWJ1bXAtdXNlLXRp bWUgd2luZG93KSkpCit3aW5kb3csIGl0IHdpbGwgc3BsaXQgdGhlIHdpbmRvdy4KKworSWYgYHJl dXNhYmxlLWZyYW1lcycgaXMgcHJvdmlkZWQgaW4gdGhlIGFsaXN0IHRoZW4KK2BkaXNwbGF5LWJ1 ZmZlci11c2UtbGVhc3QtcmVjZW50LXdpbmRvdycgd2lsbCBhdHRlbXB0IHRvIGZpbmQgdGhlCits ZWFzdCByZWNlbnQgd2luZG93IGluIGFsbCBtYXRjaGluZyBmcmFtZXMuICBCeSBkZWZhdWx0IGl0 IG9ubHkKK3NlYXJjaGVzIHRoZSBjdXJyZW50IGZyYW1lLiIKKyAgKGxldCogKChyZXVzYWJsZS1m cmFtZXMgKGNkciAoYXNzcSAncmV1c2FibGUtZnJhbWVzIGFsaXN0KSkpCisgICAgICAgICAoZnJh bWUgKG9yICh3aW5kb3ctLWZyYW1lLXVzYWJsZS1wIChzZWxlY3RlZC1mcmFtZSkpCisgICAgICAg ICAgICAgICAgICAgICh3aW5kb3ctLWZyYW1lLXVzYWJsZS1wIChsYXN0LW5vbm1pbmlidWZmZXIt ZnJhbWUpKSkpCisgICAgICAgICAod2luZG93IChvciAoZ2V0LWxydS13aW5kb3cgKG9yIHJldXNh YmxlLWZyYW1lcyBmcmFtZSkgbmlsIHQpKSkpCisgICAgKGxldCAoKHdpbmRvdworICAgICAgICAg ICAoaWYgd2luZG93CisgICAgICAgICAgICAgICAobGV0KiAoKHF1aXQtcmVzdG9yZSAoYW5kICh3 aW5kb3ctbGl2ZS1wIHdpbmRvdykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgKHdpbmRvdy1wYXJhbWV0ZXIgd2luZG93ICdxdWl0LXJlc3RvcmUpKSkKKyAgICAgICAg ICAgICAgICAgICAgICAocXVhZCAobnRoIDEgcXVpdC1yZXN0b3JlKSkpCisgICAgICAgICAgICAg ICAgICh3aGVuICh3aW5kb3ctbGl2ZS1wIHdpbmRvdykKKyAgICAgICAgICAgICAgICAgICA7OyBJ ZiB0aGUgd2luZG93IHdhcyB1c2VkIGJ5IGBkaXNwbGF5LWJ1ZmZlcicgYmVmb3JlLCB0cnkgdG8K KyAgICAgICAgICAgICAgICAgICA7OyByZXNpemUgaXQgdG8gaXRzIG9sZCBoZWlnaHQgYnV0IGRv bid0IHNpZ25hbCBhbiBlcnJvci4KKyAgICAgICAgICAgICAgICAgICAod2hlbiAoYW5kIChsaXN0 cCBxdWFkKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGludGVnZXJwIChudGggMyBx dWFkKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICg+IChudGggMyBxdWFkKSAod2lu ZG93LXRvdGFsLWhlaWdodCB3aW5kb3cpKSkKKyAgICAgICAgICAgICAgICAgICAgIChjb25kaXRp b24tY2FzZSBuaWwKKyAgICAgICAgICAgICAgICAgICAgICAgICAod2luZG93LXJlc2l6ZSB3aW5k b3cgKC0gKG50aCAzIHF1YWQpICh3aW5kb3ctdG90YWwtaGVpZ2h0IHdpbmRvdykpKQorICAgICAg ICAgICAgICAgICAgICAgICAoZXJyb3IgbmlsKSkpCisgICAgICAgICAgICAgICAgICAgKHdpbmRv dy0tZGlzcGxheS1idWZmZXIgYnVmZmVyIHdpbmRvdyAncmV1c2UgYWxpc3QpCisgICAgICAgICAg ICAgICAgICAgKHdpbmRvdy0tZXZlbi13aW5kb3ctc2l6ZXMgd2luZG93KQorICAgICAgICAgICAg ICAgICAgICh1bmxlc3MgKGNkciAoYXNzcSAnaW5oaWJpdC1zd2l0Y2gtZnJhbWUgYWxpc3QpKQor ICAgICAgICAgICAgICAgICAgICAgKHdpbmRvdy0tbWF5YmUtcmFpc2UtZnJhbWUgKHdpbmRvdy1m cmFtZSB3aW5kb3cpKSkpKQorICAgICAgICAgICAgIChkaXNwbGF5LWJ1ZmZlci1wb3AtdXAtd2lu ZG93IGJ1ZmZlciBhbGlzdCkpKSkKKyAgICAgICh3aGVuIHdpbmRvdworICAgICAgICAod2luZG93 LWJ1bXAtdXNlLXRpbWUgd2luZG93KQorICAgICAgICB3aW5kb3cpKSkpCiAKIChkZWZ1biBkaXNw bGF5LWJ1ZmZlci11c2Utc29tZS13aW5kb3cgKGJ1ZmZlciBhbGlzdCkKICAgIkRpc3BsYXkgQlVG RkVSIGluIGFuIGV4aXN0aW5nIHdpbmRvdy4KLS0gCjIuMzkuMQoK --000000000000eddf0a05f36bbe92--