alphapapa / magit-todos

Show source files' TODOs (and FIXMEs, etc) in Magit status buffer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add additional magit-section wrapping

Oghma opened this issue · comments

Hi. I started to get this error when I use M-x magit-todos-list

magit-todos: Not overriding bind of "jT" in 'magit-status-mode-map'.
helm-M-x: Wrong type argument: eieio-object, nil, obj

If I try with only magit and magit-todos enabled with the same command I get

eieio-oset: Wrong type argument: eieio-object, nil, obj

I tried to run M-x toggle-debug-on-error on an empty init.el except for magit and magit-todos and I get the following stack trace:

Debugger entered--Lisp error: (wrong-type-argument eieio-object nil obj)
  signal(wrong-type-argument (eieio-object nil obj))
  eieio-oset(nil children (#<magit-section "master" [branch] 1-38>))
  magit-insert-headers(magit-status-headers-hook)
  magit-insert-status-headers()
  magit-todos-list-refresh-buffer()
  apply(magit-todos-list-refresh-buffer nil)
  magit-refresh-buffer()
  magit-mode-setup-internal(magit-todos-list-mode nil)
  magit-mode-setup(magit-todos-list-mode)
  magit-todos-list-internal("/Users/Oghma/Documents/Progetti/prova/")
  magit-todos-list(nil)
  funcall-interactively(magit-todos-list nil)
  call-interactively(magit-todos-list record nil)
  command-execute(magit-todos-list record)
  execute-extended-command(nil "magit-todos-list" "magit-todos-li")
  funcall-interactively(execute-extended-command nil "magit-todos-list" "magit-todos-li")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

I have the issue with both mac os 10.11.6 and archlinux. I’m using emacs 26.1 and in both os I have ripgrep installed.

Hi,

Have you always had this problem, or did it start recently? Did you upgrade Magit recently? What version of it do you have? Does it happen in every repository?

Sorry if I forgot to write that information

Have you always had this problem, or did it start recently?

It started recently, one or two weeks ago.

Did you upgrade Magit recently? What version of it do you have?

Yes, i have updated magit to the latest version: Magit 20180928.1153

Does it happen in every repository?

Yes. In “old" repositories I can see the TODOs section in magit-status buffer but is not updated with the new TODO

I'm guessing that something was updated in Magit that broke this. I'll have to upgrade Magit and test. In the meantime, you may be able to work around it by downgrading Magit to the last version you had.

I think this was broken in magit/magit@40616d7. I don't yet understand why, or how to fix it. I'm looking at the old code and trying to figure out what's missing now, but I don't see what it is.

I'm calling magit-insert-status-headers, and the headers get inserted, but then the reparenting fails because the first heading has no parent in the magit-todos-list buffer. I don't know why that is, since I'm deriving from magit-status-mode. @npostavs If you could help, it would be appreciated.

@npostavs I figured it out. Sorry for the noise.

@Oghma Thank you very much for reporting.

reparenting fails because the first heading has no parent in the magit-todos-list buffer.

Maybe magit's code shouldn't signal an error in this case? If I understand correctly, before my change the lack of parent didn't cause a problem.

Maybe magit's code shouldn't signal an error in this case?

Maybe so.

If I understand correctly, before my change the lack of parent didn't cause a problem.

You're right, I don't think it did.

@tarsius What do you think?

Magit expects exactly one root section. I am surprised going against this expectations didn't cause things to fall apart more spectacularly. But there will be other issues.

Just wrap the calls to the section inserters in magit-todos-list-refresh-buffer with another magit-insert-section.

Thank you, Jonas.