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

Stop stealing focus to the preview buffer #66

Closed
tko opened this issue Feb 7, 2018 · 4 comments
Closed

Stop stealing focus to the preview buffer #66

tko opened this issue Feb 7, 2018 · 4 comments

Comments

@tko
Copy link

tko commented Feb 7, 2018

Summary

I'm trying to keep an mostly/always visible preview next to the file I'm editing, somewhat along the lines of #65 I imagine -- I can do this with (plantuml-preview 4) and it more or less works

...except that that buffer always steals the keyboard focus so that I can't just continue editing but rather always need to manually switch back to the editing. I've tried wrapping my call in (save-current-buffer) and others but it seems plantuml is switching to the buffer only after a random delay making it ineffective in practice.

Please allow updating a preview without switching to that buffer.

@floppydisken
Copy link

I have the same issue, I even tried writing a little elisp function to switch back to the previous window, with no luck. I might've messed up the function, here it is for inspection.

(add-hook 'plantuml-mode-hook
            (lambda ()
              (add-hook 'before-save-hook
                        (lambda ()
                          (plantuml-preview 4)
                          (evil-window-prev))
                        nil 'local)))

It hooks onto the save of the plantuml-mode, and tries to switch to the other window after preview has been initiated. It ends up switching to the previous buffer before the new preview window has appeared, rendering the snippet useless.

@wailo
Copy link
Contributor

wailo commented Apr 28, 2019

PR #93 addresses this issue. I will appreciate if you can try it and provide feedback

@skuro
Copy link
Owner

skuro commented Apr 29, 2019

Yep, I will have a look at #93 shortly, stay tuned for updates

skuro added a commit that referenced this issue May 3, 2019
This is yet another attempt at fixing #66, using a different approach than #93
By using `display-buffer` the preview buffer should stay wherever the user put it last
without jumping around and without stealing focus from the source buffer.

As an additional bonus, a temporary buffer is used to enable some sort of double
buffering and avoid the flicker of seeing the preview buffer disappear
@skuro
Copy link
Owner

skuro commented May 4, 2019

Closing as #93 is merged / released

@skuro skuro closed this as completed May 4, 2019
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

4 participants