casouri / vundo

Visualize the undo tree.
413 stars 20 forks source link

quit(/kill) vundo-diff window+buffer on vundo-quit #92

Closed jdtsmith closed 4 months ago

jdtsmith commented 6 months ago

vundo-diff-quit=t is the default, which means the window is buried but the buffer remains. It can be set to kill to also kill the buffer.

jdtsmith commented 6 months ago

Supersedes #89.

ideasman42 commented 6 months ago

Doesn't kill have the down side that an existing window would be closed if displaying the diff used an existing window?

89 detects and handles this case.

jdtsmith commented 6 months ago

No the buffer is always buried or killed, but quit-window does the right thing w.r.t the window. See https://www.gnu.org/software/emacs/manual/html_node/elisp/Quitting-Windows.html

jdtsmith commented 4 months ago

Any thoughts on this one @casouri ?

casouri commented 4 months ago

LGTM. Why don't we just run vundo--diff-quit at the place where we run vundo-post-exit-hook? We have the privilege of being the author of the package, we don't need to use hooks ;-)

jdtsmith commented 4 months ago

OK, sounds good. You think a -- is warranted? I removed it for consistency with other vundo-diff functions called from vundo.el.

casouri commented 4 months ago

Since vundo is a user-facing package, I would use double dash on any function not intended to be used by the user directly. But I don't really mind either way.

jdtsmith commented 4 months ago

I'm happy with either. If vundo is considered a "user" of vundo-diff, single dash (and the implied commitment to remain stable) is a bit more appropriate. But splitting hairs.

mentalisttraceur commented 4 months ago

Re: 'Why don't we just run it instead of putting it in the hook?'

So the user can still choose!

If one implementation choice lets the user pick between two potentially useful behaviors by writing a single typical config line such as setq or (remove-hook ...), and a second choice forces the user to write monkey-patching function advice to choose one of those two behaviors, the first choice is usually the right choice.

However, a separate config variable would be just as good or arguably better, and could be added later once there's actual voiced user demand for it.

casouri commented 4 months ago

I believe user can already configure this by vundo-diff-quit.

casouri commented 4 months ago

I'm happy with either. If vundo is considered a "user" of vundo-diff, single dash (and the implied commitment to remain stable) is a bit more appropriate. But splitting hairs.

Sure. If you squash and add a commit message I'll swiftly merge this :-)

jdtsmith commented 4 months ago

OK, squashed and ready.

BTW, what's your preferred method for squashing with magit when master has moved on during the development of a PR, and you've merged from master into the PR branch in the meantime? I've settled on doing a soft reset back to upstream master and recommitting, but that feels a bit dangerous.

casouri commented 4 months ago

Great, merged it, thanks!