Closed vkz closed 7 years ago
What completion system(ido/ivy/helm) are you using?
Can you provide an example of what you want starting from emacs -Q
?
See the persp-toggle-read-buffer-filter-keys
variable and try to press this key sequence when emacs waits for a buffer name from you.
I use ivy
, but running in a clean env with emacs -Q
seems to result in the same behavior:
package-initialize
persp-mode
presp-switch
init.el
in my current perspfind-file ~/.emacs.d
init.el
in elisp mode and .emacs.d
in dired mode, however .emacs.d
isn't added to the perspective. In fact this is true for any dired buffers.persp-switch-to-buffer
only shows init.el
I am able to explicitly add dired buffers to a perspective, then they do show up.
Unfortunately, I couldn't get persp-toggle-read-buffer-filter-keys
to work. C-x C-p is shadowed by mark-page
but even when global-undefined it seems to have no effect. Setting persp-toggle-read-buffer-filter-keys
to another key-binding seems to have no effect either. Is it because these are marked obsolete? 🤷♂️
Ok, I see now.) It was a bug. Can you test develop branch, please? https://github.com/Bad-ptr/persp-mode.el/tree/develop
Is it because these are marked obsolete
You are right, it is now controlled by persp-read-multiple-keys
.
Doesn't look like it makes a difference. But glad it wasn't just me going mad :)
So, here're some findings. Please, tell me if this sheds any light on the investigation. I manually edebugged the two functions that are supposed to be triggered by hooks and ostensibly add just opened buffer to current perspective as a result:
(eval-expression (persp-add-or-not-on-find-file))
which tells me that the find-file-hook
must never even run for dired buffers? Weird, but there we are. I did manage to trigger persp-add-buffer
on special buffers by setting persp-add-buffer-on-after-change-major-mode
to, say, 'free
, so that when after-major-mode-change-hook
fires persp-add-buffer
is called. This works, but I suspect I've abused some emacs internals. Perhaps you can suggest a proper solution.
the find-file-hook must never even run for dired buffers?
Yes, because find-file-hook only run when you open a file(using find-file
or find-file-noselect
). Dired buffers are created by create-buffer
and they doesn't visit any file.
There is no hook to catch create-buffer
, except the buffer-list-update-hook
, but it runs too frequently.
by setting persp-add-buffer-on-after-change-major-mode to, say, 'free, so that when after-major-mode-change-hook fires persp-add-buffer is called. This works, but I suspect I've abused some emacs internals. Perhaps you can suggest a proper solution.
I think this is the best solution if you want to add all created buffers to current perspective.
Doesn't look like it makes a difference
Maybe I was not clear what I want you to check).
I believe that I fixed C-x C-p
(while reading buffer) in develop branch. I use ivy and it works for me. Does it really don't work for you?
I think bringing some special buffers by setting after-major-mode-change-hook
works well. Of course this keeps bringing ephemeral stuff like *magit ...*
buffers into perspective, which can be solved by:
(add-hook 'persp-common-buffer-filter-functions
#'(lambda (b) (string-prefix-p "*" (buffer-name b))))
Since there could be other persp-mode users who'd like similar behavior and, in fact, may be puzzled whet they don't find some buffers in their perspectives, I would suggest adding a note and relevant code-snippets to the README. What do you think? If this is of interest I'll write it up and submit a PR.
If this is of interest I'll write it up and submit a PR.
Yes, I think this will be useful. I will welcome your contribution.
Normally I'd say hiding special buffers is great, so as to avoid Magit and friends polluting your workspace. But I can't figure out how to get my Dired buffers. When I switch buffers they don't show up and I was unable to uncover where they go. I don't have any special auto-perspectives setup. Thought maybe
persp-common-buffer-filter-functions
was doing some funky filtering, but not so. How do I get some of those special buffers back? Thanks