Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/improve prefix functionality in window delete commands #16247

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dalanicolai
Copy link
Contributor

@dalanicolai dalanicolai commented Jan 13, 2024

(Spac)Emacs comes with the kill-buffer-and-window by default (on SPC w x). Also, deleting other windows (and buffers) simply by prefixing the window delete commands with a numerical prefix is very convenient. Therefore, this commit updates (or adds) the functionality of the prefix in the window delete commands.

Summary: to delete another window (and optionally its buffer), simply prefix SPC w d (or SPC w x) with the window number.

This functionality exists in the winum package itself (on winum-select-window-by-number), but for deletion that command requires a negative prefix which is cumbersome.

@dalanicolai dalanicolai force-pushed the improve_delete_window_definitions branch 2 times, most recently from 5900287 to 32d8bca Compare January 13, 2024 16:04
(Spac)Emacs comes with the `kill-buffer-and-window` by default. Also deleting
other windows (and buffers) simply by prefixing the window delete commands with
a numerical prefix is very convenient. Therefore, this commit updates (or adds)
the functionality of the prefix in the window delete commands.

Summary: to delete another window (and optionally its buffer), simply prefix
`SPC w d` (or `SPC w x`) with the window number.
@dalanicolai dalanicolai force-pushed the improve_delete_window_definitions branch from 32d8bca to b22039c Compare January 13, 2024 16:38
Copy link
Collaborator

@smile13241324 smile13241324 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found a small issue, please check and ping me when you are ready for another review.

@@ -2338,7 +2338,7 @@ Windows manipulation commands (start with ~w~):
| ~SPC w c C~ | toggle visual distraction free mode |
| ~SPC w c .~ | center buffer and enable centering transient state |
| ~SPC w d~ | delete a window |
| ~SPC u SPC w d~ | delete a window and its current buffer (does not delete the file) |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep the old behaviour, users should have a choice between the spc u way and the pure num flavor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There already exist two bindings for deleting a window and its buffer: SPC w x and SPC b x. Therefore, I argued the binding you are referring to, is somewhat redundant.

This PR suggests that we can make better use of the SPC w d prefix, namely, to use it for quickly deleting other windows.
Currently, the only way to quickly delete another window is viaace-delete-window for which there is no default binding. However, I would argue that using a numeric prefix with SPC w d is a better alternative to ace-delete-window, as ace shows labels only after invoking it, while a window number is known already before invoking SPC w d. Furthermore, unlike ace-delete-window, this alternative does not require creating some extra (custom) binding, while also, it does not depend on ace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants