From: Pranshu Sharma <pranshusharma366@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Juri Linkov <juri@linkov.net>, Eli Zaretskii <eliz@gnu.org>,
emacs-devel@gnu.org
Subject: Re: Add function to rotate/transpose all windows
Date: Sun, 01 Dec 2024 16:41:22 +1000 [thread overview]
Message-ID: <87zflfc3cd.fsf@gmail.com> (raw)
In-Reply-To: <50ab6c0a-6afb-4727-9094-178668fc4f4e@gmx.at> (martin rudalics's message of "Sat, 30 Nov 2024 11:07:41 +0100")
[-- Attachment #1: Type: text/plain, Size: 4122 bytes --]
martin rudalics <rudalics@gmx.at> writes:
>> Right now, I feel the code is in a pretty complete state.
>
> Let's try to polish it up a little so it becomes easier to read.
>
> The doc-string of 'window-tree-pixel-sizes' should be updated. Maybe it
> should be renamed to 'window-tree-normal-sizes' too. Also, the repeated
> consing somehow obscures the fact that you are constructing a list for
> each window. So I would write, instead of
>
> ((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))))
>
> something like
>
> ((window-top-child window)
> (list t window
> (window-normal-size window nil)
> (window-normal-size window t)
> (window-tree-pixel-sizes (window-top-child window) t)))
>
> You obviously would have to make sure that my interpretation of your
> code is correct.
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
> In the commands I wonder whether the SUBTREE argument is necessary.
> Couldn't we simply say that FRAME-OR-WINDOW defaults to the parent of
> the selected window if it exists and to the selected frame's root window
> otherwise.
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.
>
> 'cycle-windows' is still a mystery to me. I think we must first make a
> clear distinction between windows and the buffers they display here. So
> far there was no need for that since "window A" meant just the window
> showing buffer A or the parent window A. That is, we silently assumed
> some sort of identity mapping between window and buffer names.
The problem with this is that that the buffers of the windows are not
changed, rather only the windows, so this would be technically inaccurate.
>
> 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.
> 'fwin' should become 'first-window' since "f" alone could be taken for
> "frame". And instead of 'selwin' I'd write 'selected-window'. Also
> writing 'win' instead of 'window' is hardly ever a "win" in my
> experience.
Ok, I ended the win streak.
> (mapc 'window-make-atom atom-windows)
>
> could be a bit of a problem (it assumes that 'window--atom-check' has
> done its work in between) but let's leave it alone for the moment.
split-window calls window--check which calls window--atom-check, so I
think it's fair to assume window--atom-check has been called. And if it
hasn't then it shouldn't change anything iiuc.
> I think these have become obsolete now.
I kept the flen one as it's still in use.
> is a very uncommon thing to do. Can't you use a lambda here?
Turns out it was uncessasary, before I needed it for something so I
could set it's value before bidning aditional stuff, not I just moved it
to the start of the BODY block of the let.
> 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.
I think the best way would be to explain visually, as Juri suggested.
Is it fine to include ascii art in docstrings?
[-- Attachment #2: window-transpose.el --]
[-- Type: application/emacs-lisp, Size: 11765 bytes --]
next prev parent reply other threads:[~2024-12-01 6:41 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 13:45 Add function to rotate/transpose all windows pranshu sharma
2024-09-24 13:53 ` Eli Zaretskii
2024-09-25 8:05 ` martin rudalics
2024-09-25 8:34 ` pranshu sharma
2024-09-25 9:31 ` martin rudalics
2024-09-25 10:50 ` pranshu sharma
2024-09-25 13:53 ` martin rudalics
2024-09-25 15:31 ` pranshu sharma
2024-09-26 14:10 ` martin rudalics
2024-09-26 14:22 ` Eli Zaretskii
2024-09-27 17:29 ` martin rudalics
2024-09-28 7:52 ` pranshu sharma
2024-09-28 9:26 ` martin rudalics
2024-09-28 10:53 ` pranshu sharma
2024-09-28 14:48 ` martin rudalics
2024-09-29 7:36 ` pranshu sharma
2024-09-29 8:40 ` martin rudalics
2024-09-29 9:23 ` pranshu sharma
2024-09-29 14:48 ` martin rudalics
2024-09-30 6:29 ` pranshu sharma
2024-09-30 8:57 ` martin rudalics
2024-10-01 9:17 ` pranshu sharma
2024-10-02 9:04 ` martin rudalics
2024-10-03 7:06 ` pranshu sharma
2024-10-03 8:17 ` martin rudalics
2024-10-03 10:09 ` pranshu sharma
2024-10-03 14:18 ` martin rudalics
2024-10-04 5:50 ` pranshu sharma
2024-10-04 8:08 ` martin rudalics
2024-10-04 15:10 ` pranshu sharma
2024-10-05 14:43 ` martin rudalics
2024-10-06 2:54 ` pranshu sharma
2024-10-06 15:02 ` martin rudalics
2024-10-06 15:52 ` pranshu sharma
2024-10-07 8:33 ` martin rudalics
2024-10-07 9:42 ` pranshu sharma
2024-10-03 15:12 ` Eli Zaretskii
2024-10-08 18:35 ` Juri Linkov
2024-10-09 6:59 ` pranshu sharma
2024-10-09 16:21 ` Juri Linkov
2024-10-10 11:49 ` pranshu sharma
2024-10-10 16:57 ` Juri Linkov
2024-10-13 5:43 ` pranshu sharma
2024-10-13 8:17 ` martin rudalics
2024-10-14 17:36 ` Juri Linkov
2024-10-15 8:34 ` pranshu sharma
2024-10-15 16:16 ` Juri Linkov
2024-10-18 14:52 ` pranshu sharma
2024-10-18 17:48 ` martin rudalics
2024-10-18 18:37 ` Eli Zaretskii
2024-10-19 1:45 ` pranshu sharma
2024-10-19 6:45 ` Eli Zaretskii
2024-10-19 18:19 ` Juri Linkov
2024-10-19 8:33 ` martin rudalics
2024-10-20 8:19 ` martin rudalics
2024-10-20 14:11 ` Pranshu Sharma
2024-10-20 17:37 ` martin rudalics
2024-10-21 5:54 ` Pranshu Sharma
2024-10-21 8:14 ` martin rudalics
2024-10-21 9:23 ` martin rudalics
2024-10-21 13:37 ` Pranshu Sharma
2024-10-22 18:12 ` martin rudalics
2024-10-24 14:38 ` Pranshu Sharma
2024-10-24 18:39 ` martin rudalics
2024-10-25 14:24 ` Pranshu Sharma
2024-10-25 17:09 ` martin rudalics
2024-10-26 9:14 ` Pranshu Sharma
2024-10-27 8:23 ` martin rudalics
2024-11-02 14:06 ` Pranshu Sharma
2024-11-05 18:01 ` martin rudalics
2024-11-08 9:23 ` Pranshu Sharma
2024-11-08 10:06 ` Pranshu Sharma
2024-11-08 15:52 ` martin rudalics
2024-11-09 2:14 ` Pranshu Sharma
2024-11-09 8:48 ` martin rudalics
2024-11-08 15:52 ` martin rudalics
2024-11-09 2:09 ` Pranshu Sharma
2024-11-09 8:48 ` martin rudalics
2024-11-09 10:55 ` Pranshu Sharma
2024-11-09 18:06 ` martin rudalics
2024-11-10 10:09 ` Pranshu Sharma
2024-11-10 16:36 ` martin rudalics
2024-11-11 14:47 ` Pranshu Sharma
2024-11-11 16:55 ` martin rudalics
2024-11-12 13:50 ` Pranshu Sharma
2024-11-12 17:46 ` martin rudalics
2024-11-16 13:36 ` Pranshu Sharma
2024-11-16 16:54 ` martin rudalics
2024-11-17 2:45 ` Pranshu Sharma
2024-11-17 10:22 ` martin rudalics
2024-11-17 15:03 ` Pranshu Sharma
2024-11-17 16:38 ` martin rudalics
2024-11-18 0:37 ` Pranshu Sharma
2024-11-18 8:55 ` martin rudalics
2024-11-19 9:34 ` Pranshu Sharma
2024-11-19 17:48 ` martin rudalics
2024-11-21 14:04 ` Pranshu Sharma
2024-11-21 17:54 ` martin rudalics
2024-11-24 13:53 ` Pranshu Sharma
2024-11-26 9:49 ` martin rudalics
2024-11-26 14:14 ` Pranshu Sharma
2024-11-27 8:29 ` Pranshu Sharma
2024-11-27 9:18 ` martin rudalics
2024-11-27 14:37 ` Pranshu Sharma
2024-11-27 17:42 ` martin rudalics
2024-11-28 2:43 ` Pranshu Sharma
2024-11-28 9:28 ` martin rudalics
2024-11-28 15:18 ` Pranshu Sharma
2024-11-30 10:07 ` martin rudalics
2024-11-30 17:41 ` Juri Linkov
2024-11-30 19:01 ` martin rudalics
2024-12-01 4:13 ` Pranshu Sharma
2024-12-01 6:41 ` Pranshu Sharma [this message]
2024-12-01 17:20 ` martin rudalics
2024-12-02 8:06 ` Pranshu Sharma
2024-10-14 17:32 ` Juri Linkov
2024-09-28 7:58 ` pranshu sharma
2024-09-28 8:18 ` Eli Zaretskii
2024-09-28 9:40 ` martin rudalics
2024-09-28 11:35 ` Eli Zaretskii
2024-09-28 14:58 ` martin rudalics
2024-09-28 15:28 ` Eli Zaretskii
2024-10-07 8:33 ` martin rudalics
2024-09-28 13:22 ` pranshu sharma
2024-09-28 14:21 ` Eli Zaretskii
2024-09-28 14:49 ` martin rudalics
2024-09-27 10:06 ` pranshu sharma
2024-09-27 17:29 ` martin rudalics
2024-09-24 17:40 ` Petteri Hintsanen
2024-09-24 19:34 ` Charles Choi
2024-09-25 2:00 ` Emanuel Berg
2024-09-25 7:00 ` pranshu sharma
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=87zflfc3cd.fsf@gmail.com \
--to=pranshusharma366@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=juri@linkov.net \
--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).