From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Add function to rotate/transpose all windows Date: Sun, 1 Dec 2024 18:20:41 +0100 Message-ID: References: <87setpdv21.fsf@gmail.com> <87cyiuefxs.fsf@gmail.com> <878qthewbq.fsf@gmail.com> <8599bc67-b05d-4afc-8e6e-1ba64a30054e@gmx.at> <87frnp2x85.fsf@gmail.com> <823c7cca-63d4-4568-94bc-11f5949d6c5c@gmx.at> <87h683muss.fsf@gmail.com> <02432e6c-6ee2-4c68-9ebb-246f6be88918@gmx.at> <877c8wadke.fsf@gmail.com> <878qt8spp2.fsf@gmail.com> <0ce35c7a-8b28-4905-a6ab-caf50f2fc750@gmx.at> <87mshl2i6h.fsf@gmail.com> <9b460366-f34e-48f6-a680-e7fa5bc7f598@gmx.at> <87bjy03fql.fsf@gmail.com> <356d63bc-818c-428c-b31b-a0eb227b3a8a@gmx.at> <87o720gjst.fsf@gmail.com> <7dfe87a0-b367-47df-86df-f8fd95163fd6@gmx.at> <8734jbz8sb.fsf@gmail.com> <50ab6c0a-6afb-4727-9094-178668fc4f4e@gmx.at> <87zflfc3cd.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14595"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Juri Linkov , Eli Zaretskii , emacs-devel@gnu.org To: Pranshu Sharma Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 01 18:21:45 2024 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 1tHndg-0003fI-L4 for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Dec 2024 18:21:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHnct-0000Dw-JX; Sun, 01 Dec 2024 12:20:55 -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 1tHnco-0000DE-3x for emacs-devel@gnu.org; Sun, 01 Dec 2024 12:20:50 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHncj-0006L9-QT; Sun, 01 Dec 2024 12:20:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1733073642; x=1733678442; i=rudalics@gmx.at; bh=4Blhzz5Evb944iVFmuQl7hsfUdiq3cCKFb4Ro94jI0w=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=uQGG+0njOym8J8jrFXqRZmWeANzbyJEqajSvhppkFOtedDVzv318L7nBf34mpMGB al5xGw3ja2fbNkrQQSQ1i3nN2qKPex/WFcjadWA4XnHnW/5l8HaOdKbfu5yjfTC7f BFsweJTKEQwI773+g5ipc1w56ybb1jFDjHEBzkXCyqy3FnUlJNmmdxy+1thXm39Mc jjnselJDwkZ76HEIN4Z3zQNXamVMCXLFOCACyJ4gzUc+DhpywB7plJzQmLfDMW4Fb PilADEJk7sOBprY9e6GhEahgytZsHRZ3oQa2Z8iy6Q+RVGSkAh+EcNDI3lqB8aYMX vbjZha0ODhnrm1ckOg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([213.142.96.49]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MV67o-1t8YSi1RfK-00N7kY; Sun, 01 Dec 2024 18:20:42 +0100 Content-Language: en-US In-Reply-To: <87zflfc3cd.fsf@gmail.com> X-Provags-ID: V03:K1:nwmEQFF7VEmY0GKZmcl3PTzRu99wfvzAdwj8DbEXHFp4BoWKHUC sr1n4Saxr2RCX2t5KA0tXpCfhRR70xkAV6HeL/OG0NV40HwaxKuwHMm8lle4iri6wxMiDrX LzyOn7tV6fua3YLt//oUqd1Lx5KpoQBR0FOSQ0tcsFcjDrDXK1Bbhk/ZoXMsZFTKSE0FZfZ uDmnjhVZPlJGmrwwOGSXw== UI-OutboundReport: notjunk:1;M01:P0:QVv9PT6ccqM=;wB77K2ABjjeFfiPhFKUDsXdqp2u eGkUJoF2zsZNJLh1rALGsVr2o7+9RhHZV5p6NY1rtr8XfF5uroP9vXljp3F43QUCvfJkSq8sd /NOvRW/LXkDoLLCUTBPhBbJEtI6Q7quTwCz4ROaiY4sCFj8SrZl/fcH1KCayu9jaUFWDcs8z3 Qpo4r1EbYXNHbTNbEYBFaY9+2D9Yt93jKI+uKcOrIcNSs4M6KgjZETFdv+SAzEyLoxFI08bnr bYWSU1jmXc03cVH/GSkUXRVzIVcEaFEoW3Cm01Z4XZxq3LZq/zJTizk/ri5CQmvXi3tPZ0+7J QqKUUT5U2x2qClSYxhZV1dHyAqKwEBNUlFT9KSGTQuRlzPiT2k8rA2QkB/+WdGJayD1nmS0Xs 8ZSgJOH+5uTuRTlLVj9VSXxe4U6Skdovv1lc8maJ2nQWcuMprKUjHgUdRUiAvxjkUp9eBlA/T FFlfwdUZmYUs8M+/sAXJeEkGXA7GwHYHLxeUO8E18PJ84E6pXzoD3PeVQUnfbDl7bzOANl7F9 sjLMb2PBGwYR9l7G0AmcGKl+C3inI+d3e43sVVYlpY7Hcy2vz0y3kvb1sSkpzco4kjeaAWgwX YYQEBCRIBOac8EiuhNJuJzHq76vPMLWZL9lCseOQUobLRMawEBYyzSS9Cge/u//e4IxrgzKi6 GfrtqUKfmx0Y77ThWvBfkowIZQMzPsLVMcNhXg1jJL2S5LcJoCKHJ1A0Mz5z3iiMv4FaJiUbq yjiuAn4ILZq5XQ2IC8AI+aIMIOyDTl3sqCMNqOqGAcqW6UcvsirYQMLue+B35ufJX1rsM/HP Received-SPF: pass client-ip=212.227.15.19; envelope-from=rudalics@gmx.at; helo=mout.gmx.net X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:325926 Archived-At: > The problem with this is that the reutn would be: > (nil/t win height width (w1 w2 w3)) > instead of: > (nil/t win height width w1 w2 w3) > So I slightly modified your code It has become worse, sorry. Please revert to the previous code but format it better as (cond ((window-top-child window) (cons (cons t window) (cons (cons (window-normal-size window nil) (window-normal-size window t)) (window-tree-pixel-sizes (window-top-child window) t)))) ((window-left-child window) (cons (cons nil window) (cons (cons (window-normal-size window nil) (window-normal-size window t)) (window-tree-pixel-sizes (window-left-child window) t)))) (t (list window (cons (window-normal-size window nil) (window-normal-size window t))))) list)) so the cons arguments pair up. > Ok, I did something similar, the problem with your idea was that if it > default to parent of selected window, then it wouldn't transpose the > frame by defualt, user will transpose frame much more than transpose a > subsection. The change I made makes it so that is works as before, but > without subtree and with the extra functionaility of being able to pass > a numric arg which will determine how {opposite word of deep here} of > windows to transpose. The numeric argument is too difficult to explain - hardly anyone will know what even the second ancestor of a live window is. So I wouldn't do that. Maybe a numeric argument could be useful to rotate by 180 or 270 degrees. But we have to keep the full explanation of the argument in the commands and also say there what rotating etc. means. Something like: "Rotate window layout anticlockwise by 90 degrees. Transform the layout of windows such that a window on top becomes a window on the right, a window on the right moves to the bottom, a window on the bottom moves to the left and a window on the left becomes one on the top. If FRAME-OR-WINDOW is nil, rotate the main window of the selected frame. If FRAME-OR-WINDOW specifies a live frame, rotate the main window of that frame. If FRAME-OR-WINDOW specifies a parent window, rotate that window. In any other case and interactively with a prefix argument rotate the parent window of the selected window." (defun window--window-to-transpose(frame-or-window) needs a space before the argument list. >> CONF, DO-NOT-CONVERT-SIZE and ATOM-WINDOWS should IMHO become lexically >> bound variables. IIUC they are never altered within the body of >> 'window--transpose-1' and only clutter up the recursions. > > I 100% agree, but I don't know how to do this without dynamic scoping. > I tried `dlet', but that didn't work. Only way I can think of is nested > functions, which idk if you would want me to do. Once we have lexical binding we can use it. On top-level do (defvar window--do-not-convert-size nil) in 'rotate-windows-...' bind it to nil and in 'flip-windows-...' to t. And in 'window--transpose-1' use it instead of 'do-not-convert-size'. But it's only a cosmetic issue so if you don't want to, don't bother. >> The words that for me fit these meanings are >> transpose-window-layout and rotate-window-layout. > > Ok, done I changed the names. But so far I can't come up with a > docsting that will also be tehcnicaly correct(can't do the buffer change > windows same route), and also understandable. When he wrote that Richard didn't know about 'cycle-windows'. He probably meant to use 'rotate-window-layout-clockwise' and 'flip-window-layout-horizontally'. > I think the best way would be to explain visually, as Juri suggested. > Is it fine to include ascii art in docstrings? Not really. Let's do that in the manual. It will become hard enough. martin