Closed gekoke closed 9 months ago
Have you tried adding patterns to evil-jumps-ignored-file-patterns
? I haven't tried it myself, but looks like it should work. Let me know if it doesn't.
Have you tried adding patterns to
evil-jumps-ignored-file-patterns
? I haven't tried it myself, but looks like it should work. Let me know if it doesn't.
That sounds like what I want. I couldn't find any mention of it in the docs. I'll try it out in a bit.
Do you know if non-file-visiting buffers being added to the jump list is expected behavior?
There's handling for non-file-visiting buffers in the code, so I'd say it probably is expected behaviour.
edit: ah that handling says if the buffer has no filename, but it does match evil--jumps-buffer-targets
then it's a valid jump target. So unless you add non-file-visiting buffer patterns there, I guess not.
Looks like this custom variable does what I need. https://github.com/emacs-evil/evil/blob/16506d934342fd905ce4c88684f04ddb123c02a4/evil-jumps.el#L55
I got around to actually trying to implement the fix, but I'm running into some issues.
The buffers I wanted to ignore are dired buffers, and dired buffers are just set to the name of whatever directory they are visiting by default.
I tried to rename the dired buffers, figuring I could just match on them that way:
(use-package evil
;; ...
:config
(evil-mode 1)
(add-hook 'dired-mode-hook (lambda () (rename-buffer (generate-new-buffer-name (format "*Dired: %s*" dired-directory)))))
(add-to-list 'evil-jumps-ignored-file-patterns "\*Dirvish.*")
(add-to-list 'evil-jumps-ignored-file-patterns "\*Dired:.*"))
But this doesn't seem to work. I'm guessing evil adds it to the jump list before the rename occurs? :/
Working back from the source code, I was able to come up with this:
(use-package evil
:config
(evil-mode 1)
(add-to-list 'evil-jumps-ignored-file-patterns ".*/$"))
This works because the filename that evil internally assigns to dired buffers always ends with a /
character.
Perhaps a evil-jump-visit-dired-buffers
custom variable or similar would be a nice-to-have.
Issue type
Is there any way to restrict certain buffers being added to the jump list?
I use dirvish, which is a wrapper around dired. Often times after I'm done using dirvish, I press
q
to bury its buffer. These visits get added to the evil jump list.I'd like to avoid this behaviour for a few reasons:
I'm not sure if this behavior is specific to dirvish, or if it's the same with plain dired as well - I haven't tested that.
I would possibly even like to restrict the jump list to only file-visiting buffers, but I'm not sure if that's exactly what I want yet.