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

New terminal frame flashes other frame's buffer before opening specified buffer #64

Closed
aaronjensen opened this issue Dec 20, 2016 · 6 comments

Comments

@aaronjensen
Copy link

When using emacs in client/server mode, if I have one client frame with a single window visiting file A, when I run emacsclient --tty B from the terminal, a new frame will open, I will briefly see A flash in emacs before it loads B.

@Bad-ptr
Copy link
Owner

Bad-ptr commented Dec 20, 2016

This happens because there is no way(or I don't know any) to distinguish the creation of a frame with a file argument and without a file argument.
When you create a frame by emacsclient --tty B it will first fire the before/after-make-frame-hook/functions by which persp-mode will restore a window configuration for the frame and only then it will come to the server-switch-hook. Only in the server-switch-hook persp-mode can see that you created the frame with intention to edit some other files and so it will show them. Hm... actually I think that for now it shows only the first file and others stay in background which is not good but I don't know how to do it better.

@aaronjensen
Copy link
Author

Which window configuration is it restoring? Can I configure persp-mode to not restore configurations for anything but my first frame? To be honest, I don't really understand what persp-mode is doing, I have auto resume layouts turned off, so it doesn't actually resume layouts when I start emacs, so I'm not sure what/why it is restoring anything in a new frame.

@Bad-ptr
Copy link
Owner

Bad-ptr commented Dec 20, 2016

Can I configure persp-mode to not restore configurations for anything but my first frame?

Yes, I believe you can. See persp-init-frame-behaviour, persp-init-new-frame-behaviour-override, persp-interactive-init-frame-behaviour-override, persp-emacsclient-init-frame-behaviour-override, persp-server-switch-behaviour variables.

To be honest, I don't really understand what persp-mode is doing, I have auto resume layouts turned off, so it doesn't actually resume layouts when I start emacs, so I'm not sure what/why it is restoring anything in a new frame.

Then why don't you just M-x package-delete RET persp-mode RET or just switch persp-mode off then? Anyway you can remove persp-mode functions from emacs hooks:

    (remove-hook 'find-file-hook               #'persp-add-or-not-on-find-file)
    (remove-hook 'kill-buffer-query-functions  #'persp-kill-buffer-query-function)
    (remove-hook 'kill-buffer-hook             #'persp-kill-buffer-h)
    (remove-hook 'before-make-frame-hook       #'persp-before-make-frame)
    (remove-hook 'after-make-frame-functions   #'persp-init-new-frame)
    (remove-hook 'delete-frame-functions       #'persp-delete-frame)
    (remove-hook 'kill-emacs-query-functions   #'persp-kill-emacs-query-function)
    (remove-hook 'kill-emacs-hook              #'persp-kill-emacs-h)
    (remove-hook 'server-switch-hook           #'persp-server-switch)
    (remove-hook 'after-change-major-mode-hook #'persp-after-change-major-mode-h)

@aaronjensen
Copy link
Author

Ok, I'll take a look at those variables, thank you.

I use spacemacs, which uses persp-mode to manage its layouts, which I do use (and appreciate) extensively.

@Bad-ptr
Copy link
Owner

Bad-ptr commented Dec 20, 2016

May be this is related #36

@aaronjensen
Copy link
Author

Awesome, thanks, (setq persp-emacsclient-init-frame-behaviour-override nil) did the trick for me.

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