abougouffa / minemacs

MinEmacs: an Emacs configuration framework for daily use
https://abougouffa.github.io/minemacs/
MIT License
143 stars 16 forks source link

Periodic errors from consult-line #37

Closed jonathanwilner closed 1 year ago

jonathanwilner commented 1 year ago

This may very well be a personal configuration issue, but I think it's over my head to figure out how to track what's impacting the positioning using consult-line.

I don't get the error every time - and I can't quite figure out how to repro - or in any particular mode. Happy to hunt for this if it's happening to others, or hoping for a tip on how to solve this!


Debugger entered--Lisp error: (wrong-number-of-arguments (2 . 2) 0)
  jit-lock-fontify-now()
  consult--fontify-all()
  consult--line-candidates(nil 5)
  #f(compiled-function () #<bytecode 0x161546aac7a86936>)()
  funcall-with-delayed-message(1 "Collecting lines..." #f(compiled-function () #<bytecode 0x161546aac7a86936>))
  #f(compiled-function (&optional initial start) "Search for a matching line.\n\nDepending on the setting `consult-point-placement' the command\njumps to the beginning or the end of the first match on the line\nor the line beginning.  The default candidate is the non-empty\nline next to point.  This command obeys narrowing.  Optional\nINITIAL input can be provided.  The search starting point is\nchanged if the START prefix argument is set.  The symbol at point\nand the last `isearch-string' is added to the future history." (interactive #f(compiled-function () #<bytecode 0x1a52eb717942>)) #<bytecode -0x170ea6eb75f6d515>)(nil)
  apply(#f(compiled-function (&optional initial start) "Search for a matching line.\n\nDepending on the setting `consult-point-placement' the command\njumps to the beginning or the end of the first match on the line\nor the line beginning.  The default candidate is the non-empty\nline next to point.  This command obeys narrowing.  Optional\nINITIAL input can be provided.  The search starting point is\nchanged if the START prefix argument is set.  The symbol at point\nand the last `isearch-string' is added to the future history." (interactive #f(compiled-function () #<bytecode 0x1a52eb717942>)) #<bytecode -0x170ea6eb75f6d515>) nil)
  +consult--dwim-first-arg-a(#f(compiled-function (&optional initial start) "Search for a matching line.\n\nDepending on the setting `consult-point-placement' the command\njumps to the beginning or the end of the first match on the line\nor the line beginning.  The default candidate is the non-empty\nline next to point.  This command obeys narrowing.  Optional\nINITIAL input can be provided.  The search starting point is\nchanged if the START prefix argument is set.  The symbol at point\nand the last `isearch-string' is added to the future history." (interactive #f(compiled-function () #<bytecode 0x1a52eb717942>)) #<bytecode -0x170ea6eb75f6d515>) nil nil)
  apply(+consult--dwim-first-arg-a #f(compiled-function (&optional initial start) "Search for a matching line.\n\nDepending on the setting `consult-point-placement' the command\njumps to the beginning or the end of the first match on the line\nor the line beginning.  The default candidate is the non-empty\nline next to point.  This command obeys narrowing.  Optional\nINITIAL input can be provided.  The search starting point is\nchanged if the START prefix argument is set.  The symbol at point\nand the last `isearch-string' is added to the future history." (interactive #f(compiled-function () #<bytecode 0x1a52eb717942>)) #<bytecode -0x170ea6eb75f6d515>) (nil nil))
  #f(advice +consult--dwim-first-arg-a :around #f(compiled-function (&optional initial start) "Search for a matching line.\n\nDepending on the setting `consult-point-placement' the command\njumps to the beginning or the end of the first match on the line\nor the line beginning.  The default candidate is the non-empty\nline next to point.  This command obeys narrowing.  Optional\nINITIAL input can be provided.  The search starting point is\nchanged if the START prefix argument is set.  The symbol at point\nand the last `isearch-string' is added to the future history." (interactive #f(compiled-function () #<bytecode 0x1a52eb717942>)) #<bytecode -0x170ea6eb75f6d515>))(nil nil)
  apply(#f(advice +consult--dwim-first-arg-a :around #f(compiled-function (&optional initial start) "Search for a matching line.\n\nDepending on the setting `consult-point-placement' the command\njumps to the beginning or the end of the first match on the line\nor the line beginning.  The default candidate is the non-empty\nline next to point.  This command obeys narrowing.  Optional\nINITIAL input can be provided.  The search starting point is\nchanged if the START prefix argument is set.  The symbol at point\nand the last `isearch-string' is added to the future history." (interactive #f(compiled-function () #<bytecode 0x1a52eb717942>)) #<bytecode -0x170ea6eb75f6d515>)) (nil nil))
  consult-line(nil nil)
  funcall-interactively(consult-line nil nil)
  call-interactively(consult-line nil nil)
  command-execute(consult-line)
  recursive-edit()
  debug(debug)
  debug--implement-debug-on-entry(nil nil)
  apply(debug--implement-debug-on-entry (nil nil))
* consult-line(nil nil)
  funcall-interactively(consult-line nil nil)
  call-interactively(consult-line nil nil)
  command-execute(consult-line)
abougouffa commented 1 year ago

Hello @jonathanwilner , Thanks for reporting this.

Can you explain the context in which you are getting this error? I should be able to reproduce it to debug it.

abougouffa commented 1 year ago

Hi again @jonathanwilner

I've pushed a commit that should solve this. Please let me know if this fixes the issue.

jonathanwilner commented 1 year ago

Hi - you are right that it was happening in the mini-buffer. I unfortunately believe it may still be occurring, but now I also know where to explore. I'll keeping going and see if it's either gone or I can consistently reproduce.

Thanks!

abougouffa commented 1 year ago

I suspect the advice around consult commands to be the source of this issue. You can disable the advices by dropping this in your config.el, this can help to identify if this is really the cause of the problem.

(with-eval-after-load 'consult
  (dolist (cmd '(consult-line consult-man))
    (advice-remove cmd #'+consult--dwim-first-arg-a))
  (dolist (cmd '(consult-ripgrep consult-line-multi consult-grep consult-find))
    (advice-remove cmd #'+consult--dwim-second-arg-a)))
jonathanwilner commented 1 year ago

@abougouffa - THANK YOU ! This looks like it's working.

jonathanwilner commented 1 year ago

Nope - it's definitely still happening. When the mini-buffer frame is small, it can prompt an args out of range error. Making the mini-buffer/frame wider will usually (potentially always) solve the problem.

abougouffa commented 1 year ago

I didn't get it! What steps can I apply to reproduce the issue?

Did you try to add the snippet mentioned above to your config.el? If yes, then I think the issue should be reported to consult, the advices are the only tweak I apply to consult's commands.

jonathanwilner commented 1 year ago

Hi - I did try it and it doesn't help. If you squeeze down the size of the Emacs app far enough, you can likely see the error happen pretty consistently. :-(

abougouffa commented 1 year ago

In this case, I think this should be reported in the consult repo.

NB: I didn't manage to reproduce the bug!

donneyluck commented 1 year ago

Hi - I did try it and it doesn't help. If you squeeze down the size of the Emacs app far enough, you can likely see the error happen pretty consistently. :-(

i think you can make prune and reinstall

jonathanwilner commented 1 year ago

I switched to a non native-compilation build of Emacs and the problem disappeared. I'm going to close this one and apologize for wasting time !

abougouffa commented 1 year ago

Aha! It could be related to this https://github.com/abougouffa/minemacs/issues/38#issuecomment-1482611285