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

Add crux-transpose-windows for swapping the buffers between two windows #21

Merged
merged 2 commits into from
Feb 14, 2016

Conversation

dgtized
Copy link
Contributor

@dgtized dgtized commented Feb 13, 2016

This is copied directly from
https://www.emacswiki.org/emacs/TransposeWindows, and renamed to
crux-tranpose-windows. The wiki page mentions the original author as
Thomas Bellman. It does not appear to be published in any existing
package that I could find.

@bbatsov
Copy link
Owner

bbatsov commented Feb 14, 2016

Looks good, just squash the two commits together. Adding a brief description of the difference with swap-windows would be useful as well I guess.

@dgtized
Copy link
Contributor Author

dgtized commented Feb 14, 2016

Squashed the commits together. In terms of the difference between transpose and swap, swap only works for 2 open windows (and only for two, it errors out if there are more). To be honest, I'm not sure I can think of any case where swap-windows would be preferable to transpose. As far as I know, transpose is a superset of the functionality of swap-windows.

@dgtized dgtized force-pushed the transpose-windows branch 3 times, most recently from 1384522 to c24c94d Compare February 14, 2016 09:52
(set-window-buffer (selected-window) next-win)
(set-window-buffer (funcall selector) this-win)
(select-window (funcall selector)))
(setq arg (if (plusp arg) (1- arg) (1+ arg))))))
Copy link
Owner

Choose a reason for hiding this comment

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

Btw, this should be cl-plusp. (or just (< 0 arg))

@bbatsov
Copy link
Owner

bbatsov commented Feb 14, 2016

As far as I know, transpose is a superset of the functionality of swap-windows.

Probably we can mark the other function as obsolete and remove it down the road then.

@dgtized
Copy link
Contributor Author

dgtized commented Feb 14, 2016

Fixed the cl-plusp issue, and documented the behavior on prefix arguments like 2 or -2.

The only part about swap-windows that I don't follow is why it calls set-window-start, I think that is actually unnecessary but not sure. I'm fine with marking it deprecated. I think you could even alias it to transpose windows, and no one would notice.

@bbatsov
Copy link
Owner

bbatsov commented Feb 14, 2016

I think you could even alias it to transpose windows, and no one would notice.

Good idea. Alias it and remove it from the readme.

@dgtized
Copy link
Contributor Author

dgtized commented Feb 14, 2016

Should that also be squashed in, a second commit or a different PR?

@bbatsov
Copy link
Owner

bbatsov commented Feb 14, 2016

Second commit, same PR.

@dgtized dgtized changed the title Add crux-tranpose-windows for swapping the buffers between two windows Add crux-transpose-windows for swapping the buffers between two windows Feb 14, 2016
This is copied directly from
https://www.emacswiki.org/emacs/TransposeWindows, and renamed to
crux-tranpose-windows. The wiki page mentions the original author as
Thomas Bellman. It does not appear to be published in any existing
package that I could find.

Amend documentation string to appease checkdoc
Added documentation explaining ARG count > 1 or < -1
Use cl-plusp over plusp
bbatsov added a commit that referenced this pull request Feb 14, 2016
Add crux-transpose-windows for swapping the buffers between two windows
@bbatsov bbatsov merged commit 5938c84 into bbatsov:master Feb 14, 2016
@bbatsov
Copy link
Owner

bbatsov commented Feb 14, 2016

👍

@dgtized dgtized deleted the transpose-windows branch February 14, 2016 10:37
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.

2 participants