ndwarshuis / org-sql

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

Updating taking long / config problem? #4

Open plur9 opened 4 years ago

plur9 commented 4 years ago

Hello,

I'm trying to get org-sql running but have been scratching my head for the past hours over unusual behaviour:

Configuration seems ok (macOs, Catalina), creating a db worked. As I'm not really experienced in emacs (i.e. lisp), I'm not sure if I configured it ok. I've installed it from Melpa and this is what I have in the config file:

(use-package org-sql :ensure t ;; add config options here... :config (setq org-sql-files '("~/org/inbox.org")) )

Any ideas?

ndwarshuis commented 4 years ago

Can you post what headlines seem to be causing the problem? I've also never tested this on mac; I know there are a few problems in windows.

plur9 commented 4 years ago

Sure. Here it is:

Interesting to note is also that update in general doesn't work second time. For example:

ndwarshuis commented 4 years ago

I can't reproduce this on my system but I'm using linux and I don't have a Mac to test this. It sounds like the SQL buffer is getting hung on a command that isn't completing. Two things:

  1. Try deleting the *SQL: Org* buffer (and killing the process) after the hang and repeating the commands in the OP. Since you probably won't be able to do anything when org-sql is hung, Ctrl-G should kill the command and allow you to kill the buffer.
  2. If 1 succeeds, go into the source code and run edebug-eval-top-level-form on the function org-sql-user-update right before running the command that hangs (this will run the debugger whenever org-sql-user-update is called). Run the hanging command and step through the function (press space repeatedly) and you will see output in the minibuffer as you evaluate each sexp. Post the output that shows up after stepping through (org-sql-update-db) (if it is normal it should be (nil nil nil) but I'm guessing it will have some error message in the place of one of the nils.)
ndwarshuis commented 4 years ago

To make 2 easier above, I just pushed a commit that will print the errors you are supposed to see if they exist and you follow the edebug steps. 58a2482672b3af3347dfa789e0f659f2144ae362 adds a debug option which can be enabled by running (setq org-sql-debug t). If necessary, please activate this and run your command sequence again instead of 2, and post the output here if it says anything besides "Run successfully" or "Not run".

vonHabsi commented 4 years ago

Consider running .trace and .log statements in the SQL: Org buffer before executing org-sql-user-reset and org-sql-user-update. The .help command will give you more info on it.

That's what helped me to diagnose my issue

plur9 commented 4 years ago

Awesome! Plan to give it a try asap when I get some time. Will report.