purcell / ibuffer-vc

Let Emacs' ibuffer-mode group files by git project etc., and show file state
171 stars 11 forks source link

ibuffer-current-state-list: Args out of range: #<buffer *Ibuffer*>, 207, 259 #19

Closed wdenton closed 7 years ago

wdenton commented 7 years ago

ibuffer-vc stopped working very recently and throws this error when I run it. Instead of showing all the buffers I have in their various projects and source trees, it just shows two or three under Default.

Running emacs -Q and loading in the package shows no problem.

This is on Emacs 26.0.50.20, compiled from the development source in Git. I see no changes have been made to this code recently, so perhaps there's some conflict somewhere else?

purcell commented 7 years ago

This is likely due to an out-of-date ibuffer-vc.elc file. Or simply a bug in ibuffer in that development version of Emacs.

alt-vena commented 7 years ago

I have the same.

ibuffer-vc version: Package-Version: 20161103.2358 emacs version: 26.0.50.1

purcell commented 7 years ago

Yep, okay. So have you recompiled ibuffer-vc.el since upgrading your Emacs? I don't see that there's anything that could need to be fixed in ibuffer-vc, so my previous comment stands unless someone can investigate and tell me otherwise. :-)

johnmastro commented 7 years ago

I ran into this too. I haven't had a chance to investigate much and find out what changed, but it appears to be caused by a bug (or just incompatibility) in Emacs 26's ibuffer.

I'll see about submitting a patch to ibuffer. In the meantime I found a workaround that seems to work, at least so far:

(defun ibuffer-vc--status-string-no-nil (result)
  "Advice for `ibuffer-vc--status-string'. Don't return nil."
  (or result ""))

(advice-add 'ibuffer-vc--status-string :filter-return
            #'ibuffer-vc--status-string-no-nil)

(Replacing the definition of ibuffer-vc--status-string to return the empty string rather than nil also works, but since I suspect this is something that can/should be addressed in ibuffer itself I'm just using this as a bandaid).

johnmastro commented 7 years ago

I've now submitted a patch to Emacs that I believe fixes this.

In my description of the bug/patch, you may notice that I mention a "wrong type argument" error, whereas this thread mentions an "args out of range" error. I believe they have the same cause. In my testing, the "wrong type argument" happened the first time ibuffer was invoked, followed by "args out of range" for any subsequent invocations (unless you explicitly killed the *Ibuffer* buffer, in which case it would go back to the "wrong type argument" error on the first call after that).

johnmastro commented 7 years ago

The patch I proposed has been applied in Emacs's master branch.

purcell commented 7 years ago

Nice work @johnmastro! I'll go ahead and close this issue.