Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating taking long / config problem? #4

Open
plur9 opened this issue Feb 2, 2020 · 6 comments
Open

Updating taking long / config problem? #4

plur9 opened this issue Feb 2, 2020 · 6 comments

Comments

@plur9
Copy link

plur9 commented Feb 2, 2020

Hello,

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

  • installation and configuration went through ok. Installed it from Melpa. (1 file compiled, 2 skipped)
  • M-x org-sql-user-reset works ok.
  • M-x org-sql-user-update works ok with 4 headlines
  • M-x org-sql-user-clear-all works ok
  • Another org-sql-user-update and clear-all work ok
  • I add 5th heading, update gets stuck, clear all gets stuck,...
  • If I delete the org.db and start again, it gets stuck with 5 headings.

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
Copy link
Owner

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
Copy link
Author

plur9 commented Feb 2, 2020

Sure. Here it is:

  • TODO Task 1
  • Inserted task
  • TODO Task 2
    ** TODO Another task
  • [#B] One more

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

  • reset => OK
  • update (4 records) => OK
  • delete one heading
  • update (3 records) => says OK but nothing changes in db

@ndwarshuis
Copy link
Owner

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
Copy link
Owner

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. 58a2482 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
Copy link

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
Copy link
Author

plur9 commented Feb 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants