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

Exiting vundo should (optionally) exit vundo-diff #88

Open
ideasman42 opened this issue Dec 21, 2023 · 1 comment
Open

Exiting vundo should (optionally) exit vundo-diff #88

ideasman42 opened this issue Dec 21, 2023 · 1 comment

Comments

@ideasman42
Copy link
Contributor

ideasman42 commented Dec 21, 2023

It would be good if quitting vundo would also close the vundo-diff buffer & window.
So viewing a vundo-diff buffer doesn't leave this buffer open once I've finished using vundo (which I need to manually exit). I'm not so fussed on this being on by default or not, just that it would be nice if it's a toggle.

Of course it's possible to write advice that does this but it seems like something users might want to enable without the hassle of implementing this themselves.

Note that vundo-post-exit-hook can't easily be used for this as the vundo buffer has been deleted (which is needed to access the name of the diff buffer).


This advice for vundo-quit works but it involves using internal names.

(advice-add
 'vundo-quit
 :around
 #'(lambda (old-fn &rest args)
     (let* ((orig vundo--orig-buffer)
            (oname (buffer-name orig))
            (diff-buf (get-buffer (concat "*vundo-diff-" oname "*"))))
       (when diff-buf
         (let ((diff-window (get-buffer-window diff-buf)))
           (when diff-window
             (delete-window diff-window))
           (kill-buffer diff-buf)))

       (let ((result (apply old-fn args)))
         result))))
@jdtsmith
Copy link
Contributor

#92 should I think do what you want; let me know if not.

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

No branches or pull requests

2 participants