13

I ran a command and received a warning in the minibuffer.

The exact warning was comint-completion-at-point failed to return valid completion data, after I autocompleted a command in shell-mode.

How can I determine the elisp origin of the warning?

Constantine
  • 9,072
  • 1
  • 34
  • 49
Matthew Piziak
  • 5,958
  • 3
  • 29
  • 77
  • 1
    `C-h f comint-completion-at-point`, then click the file name to see the source code. Look for that error message. (You can also grep for the error msg in the Lisp sources, to find it.) – Drew Dec 11 '14 at 16:33
  • Have a look at the manual on [Debugging Lisp Programs](http://www.gnu.org/software/emacs/manual/html_node/elisp/Debugging.html#Debugging). – freakhill Dec 11 '14 at 16:31

1 Answers1

19

As pointed out in the other answer you'll find the fine manual useful for all the debug tools it has. For you specific problem I'd consider:

(setq debug-on-message "comint-completion-at-point failed to return valid completion data")

As the help text states:

If non-nil, debug if a message matching this regexp is displayed.

From this you should get a backtrace when the failure hits. You can then instrument the functions in question with C-u C-M-x and step through the failure next time it occurs for more information.

stsquad
  • 4,626
  • 28
  • 45
  • 3
    This is an excellent answer. Thank you. I think you have an extra quote in your first line, where you combine `setq` and `'debug-on-message`. Changing it to `setq debug-on-message` or `set 'debug-on-message` fixed it for me. – Matthew Piziak Dec 11 '14 at 17:11
  • @MatthewPiziak: thanks - overzealous quoting fixed. – stsquad Dec 11 '14 at 22:47
  • This is so much better than zgrepping the Emacs compressed sources! Only downside of this is that the problematic condition must occur before one can debug it. –  Dec 25 '19 at 12:26