evil-alternate-buffer doesn't respect frame parameter buffer-predicate
- Dominant language
- Emacs Lisp
- Stars
- 3.9k
- Forks
- 307
- PR merge metrics
- No merged PRs in 30d
Description
Originally reported by: **bmag (Bitbucket: [bmag](https://bitbucket.org/bmag), GitHub: [bmag](https://github.com/bmag))**
----------------------------------------
`buffer-predicate` is a frame parameter that filters out "uninteresting" buffers for functions such as `next-buffer` and `other-buffer`. However, `evil-alternate-buffer` doesn't use this predicate to filter out possible alternate buffers. I am not sure if it is a bug or the intended behavior.
I've found this issue while trying to solve a [Spacemacs issue](https://github.com/syl20bnr/spacemacs/issues/6159). We can solve (the evil-related part of) the issue on our side, but I'm reporting in case you decide it's a bug in `evil-alternate-buffer`.
Reproduction guide:
- Start emacs and enable evil-mode
- Evaluate this code:
```
#!elisp
(defun next-buffer-p (buffer)
(string-prefix-p "test" (buffer-name buffer)))
(set-frame-parameter nil 'buffer-predicate 'next-buffer-p)
```
- Create buffer "test1" (e.g. with `C-x b`)
- Create buffer "blah"
- Create buffer "test2"
- Call `evil-alternate-buffer` (e.g. with `M-:`)
Observed behavior:
`evil-alternate-buffer` returns buffer "blah" (and two markers in that buffer)
Expected behavior:
`evil-alternate-buffer` should return buffer "test1"?
Emacs version: 24.5.1
Evil version: evil-git-1b77fd8
Operating system: Ubuntu 16.04
----------------------------------------
- Bitbucket: https://bitbucket.org/lyro/evil/issue/680
Contributor guide
Research direction
Start by inspecting the implementation of evil-alternate-buffer and reproduce the issue with the supplied next-buffer-p function and frame buffer-predicate. Compare its buffer selection with Emacs functions such as next-buffer and other-buffer; done means the reported predicate behavior is clarified and the reproduction selects the expected buffer if this is confirmed as a bug.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs-lisp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100