From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pranshu Sharma Newsgroups: gmane.emacs.devel Subject: Re: Add function to rotate/transpose all windows Date: Mon, 02 Dec 2024 18:06:37 +1000 Message-ID: <87y10ycxv6.fsf@gmail.com> References: <87setpdv21.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 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16890"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Juri Linkov , Eli Zaretskii , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 02 12:59:54 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 1tI55l-0004F1-Ud for ged-emacs-devel@m.gmane-mx.org; Mon, 02 Dec 2024 12:59:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tI54r-0005kY-09; Mon, 02 Dec 2024 06:58:57 -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 1tI1SA-0005Tn-ML for emacs-devel@gnu.org; Mon, 02 Dec 2024 03:06:46 -0500 Original-Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tI1S8-0002Yp-EV; Mon, 02 Dec 2024 03:06:46 -0500 Original-Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2155157c31fso16243155ad.1; Mon, 02 Dec 2024 00:06:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733126802; x=1733731602; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=x/M+7cqmOGERhv0/RmgYyQZD8wWoOuxX0u1wYwbYsxI=; b=hIHTfhs36+iFxQhVD9qTD19zzGVYRQ1n29j38qD7qXGp/cZy6dzYMfTu5OppyBCBjK dp3xPFB2mrJSVNsSN6Xfm18Fs23Rl7h3Oi4HiLThfZG2UXq4Jj261EK9KCPpyvNvhQID j97XjJ+9WN7zmOD82TYgTOHSA0sFv8JKNitnpt57x4cqt8jjfIcbxUN9pG244G4IOLrt 2tWeYhw6eur5xo7Ca/rpE1kvOFFzQPEFVIfScHlHVyzDcDHltL4obuV5wzEdjqpxR6hY xJxzSpMQhRnAZzhy2VXZdRuv4RE+QxNbrbLOzB9ajwXApvUk4PldyEBPfvAJO7G/SFbh 9imw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733126802; x=1733731602; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=x/M+7cqmOGERhv0/RmgYyQZD8wWoOuxX0u1wYwbYsxI=; b=JzvezWx7h27ncWnDCiZ/1ddrXl9nyfpAa841MUbk42Iivgn2UuA01zIz/93mrjGxuT GwGL4DDS2I3OChFn7wgSi8HfFa5qXus2uMkBoCIwio53m5nIq0E3VfDRkmF8uqCLe6Pr 3F/gL/bzaMwnLEJdvacqNlGOPQSFLaegKa03Yd2K3tndIlzbCKehpOvkyoe/v1t2IEKq NpiXgBayKsNMhwDrEAN8+K0tEZ9LwFC1LOpLe1Q25PO/wiOsglEqsM7DFZZvUB5K6FR6 v8wTOAMC4beHqk70vxEgE9tImPN7Eupvcg2ccJVvz0w/CkZ8js2M/8WMpjdhv/3AFYS7 0OYQ== X-Forwarded-Encrypted: i=1; AJvYcCVCtVzDkayMB/eWYRGUAhJdnMZL+qKoRcb4RV4AOOcsOnGQHfkSuymFJmzK+vLKWfewRJuqTURAso/N/G0=@gnu.org, AJvYcCXhT2GOI65u5d/GuYWQPxUXLqNHjuzmPgoQH6KByK60Qul3y5lblSoqgoG9qNXOEsn/3vgp@gnu.org X-Gm-Message-State: AOJu0YzniW20mok39Kt1Qf97Y3Z8gDfWaWo9SEt8BylMsbMYwH0tywBW kiAzyIxZoD0HkArg3qYKW4fgt8b62eJehALST5DKqQc6VNHlHFpaj/MgqGHW X-Gm-Gg: ASbGncttR4c8bo5b5d9yYYmj057AHqlINArKUXoJa0XpJr/A5tGHBW0qNoGJvurGZJs 4AasIhgTlgSn3NEN8iTEUnqhg0yBB+n5//bkaqizmhtsNuNpm6zZYTwGgiucSrZ7KcjSM0ai70O J7jZLQBnuZdMV9drRFJCnmd+fLk0hl0bIdgYxWc5/9DCuUvnL3SMDUtQ6gJsR8Clr1h7YL3PBfi k1t+wVyNDNoB9hqHElsDxQENc4y2DfyVQ0Js+Znorv2pjgVNQFgog== X-Google-Smtp-Source: AGHT+IGqsbRpg+18ZL2H7f3iZ0b1HB/VWwyTK5mJFIIMFsI7HJIy6sPbaqWjZhftCB0jMKFYGJwxyw== X-Received: by 2002:a17:903:191:b0:20e:df57:db50 with SMTP id d9443c01a7336-2151d863470mr242294555ad.18.1733126801927; Mon, 02 Dec 2024 00:06:41 -0800 (PST) Original-Received: from pebl ([2001:8003:7816:8300:e5d6:2239:e658:dc31]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725417fb950sm8101587b3a.121.2024.12.02.00.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 00:06:41 -0800 (PST) In-Reply-To: (martin rudalics's message of "Sun, 1 Dec 2024 18:20:41 +0100") Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=pranshusharma366@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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-Mailman-Approved-At: Mon, 02 Dec 2024 06:58:54 -0500 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:325940 Archived-At: martin rudalics writes: >> 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 > If your problem was with: `(nil ,window ,(window-normal-size window nil) ,(window-normal-size window t) . ,(window-tree-normal-sizes (window-left-child window) t)) I changed it to: (append (list nil window (window-normal-size window nil) (window-normal-size window t)) (window-tree-normal-sizes (window-left-child window) t))) Do you still want me to go back? >> 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. This would only be applicable to rotate commands, but window--window-to-transpose is used for all the commands. the ancestor thing will be useful, it's worth at least attemptign to explain. > But we have to keep the full explanation of the argument in the commands > and also say there what rotatinig 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." > Fine, I'll do this once we sort out the behaviour of window--window-to-transpose. >>> 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. Ok, I won't do this then, I don't want to clutter up the window- namespace unless neccasary. > 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'. > Doing clockwise and anti clockwise would not neccasaryly be accurate, it operats more like other-window, saying other-window-anticlockwise for (other-window -1) would not be accurate. Doc string of other-window: Select another window in cyclic ordering of windows. This is why I think reverse makes the most sense techncially. Also I fixed all of the byte compile warnings.