ndwarshuis / org-sql

SQL backend for Emacs Org-Mode
GNU General Public License v3.0
97 stars 9 forks source link

No prompt found or ‘comint-prompt-regexp’ not set properly #2

Open llcc opened 5 years ago

llcc commented 5 years ago

Thanks for your great package.

I freshly installed it and called org-sql-user-reset. It gave me this error message. No prompt found or ‘comint-prompt-regexp’ not set properly.

System: Windows 10, Emacs 26.1

ndwarshuis commented 5 years ago

Two things to check:

  1. Is the value of comint-prompt-regexp set? (mine is "^")
  2. Is there a buffer called *SQL: Org* after running org-sql-user-reset? If not, can you please non-interactively run (org-sql-cmd-open-connection) and send any errors that appear in *Messages*? (this function should just return nil)
llcc commented 5 years ago

Hi @ndwarshuis

  1. comint-prompt-regexp returns "^" as yours.
  2. *SQL: Org* buffer exists as an empty buffer. Eval (org-sql-cmd-open-connection) produces
    Login...done
    comint-redirect-send-command-to-process: No prompt found or ‘comint-prompt-regexp’ not set properly

in message buffer.

ndwarshuis commented 5 years ago

haven't solved this yet but found several problems:

  1. starting a sqlite process buffer on windows produces no prompt (it should be "sqlite> "). The buffer appears to work fine when typing directly into it, but fails with the "No prompt found" error from OP when using any function that calls comint-redirect-send-command-to-process' (which includes thesqlite-redirect-onefunction called fromorg-sql-cmdin this package). The error happens becausecomint-redirect-send-command-to-process` looks for the "sqlite> " prompt but cannot find it.
  2. It is possible to override the expected prompt with a regular expression "^" (instead of "^sqlite> ") by changing the sql-product-alist variable. Sending commands seems to work, but they hang the entire Emacs process unless they produce output it seems. I haven't figured out why yet.

For now, the only workaround is to run this on Linux, unfortunately. Since the root cause is actually in comint (which is part of Emacs itself) I will file a bug upstream. Will keep this open though in case they suggest a hacky workaround (or I find one).