MobileOrg / mobileorg

MobileOrg iPhone App
http://mobileorg.github.io
GNU General Public License v2.0
557 stars 70 forks source link

Emacs org-mobile-pull error #285

Closed alitoiu closed 2 years ago

alitoiu commented 2 years ago

Hi, I'm trying to sync .org files on Mac and iPhone through MobileOrg. Things working file until running the org-mobile-pull command to try to pull the files that were sent from iPhone to my staging folder (defined in org-mobile-directory) back into the original file (named 220212.org).

I M-x org-mobile-pull, and get the following error: Wrong type argument: stringp, nil

Contents of mobileorg.org (file that contains the updates that were performed on the phone) prior to running org-mobile-pull:

 * F(edit:todo) [[olp:220212.org:s/stretch neck right][stretch neck right]]
 ** Old value
 TODO
 ** New value
 DONE
 ** End of edit

After running org-mobile-pull and seeing the error: empty

I'm new to debugging lisp code or emacs, but I tried setting to true "debug-on-error" and "debug-on-entry" for org-mobile-pull in emacs. Having a bit of trouble figuring out exactly where in the function that is but it seems to be in the first few commands. Might try to master the debugger and debug further.

My .init.el contains org-directory, org-mobile-inbox-for-pull, org-mobile-directory, org-mobile-files, org-mobile-force-id-on-agenda-items all set, in my opinion, appropriately.

Does anybody know what is causing this? As a result of this error, the changes in mobileorg.org are not synced back into the original 220212.org file.

Edit: formatting Edit2: I should note that org-mobile-push seems to successfully populate the staging folder. I can then sync those files to the app. From the app, I can then sync the files back into the staging folder. Issue only occurs with the org-mobile-pull command from emacs. If this is more an issues tracker for the iPhone app side of things (which seems to be working), then where can I ask this more emacs-related question?

alitoiu commented 2 years ago

Seem to have figured out the problem. Since I'm new to the org-mobile API, I didn't (and probably still don't) fully get what's happening. Fundamentally, I confused the inbox file with the mobileorg.org file. Originally, I pointed the org-mobile-inbox-for-pull to mobileorg.org which seems to have led to an error. I then realized that org-mobile.el already knows how to find mobileorg.org inside the org-mobile-directory, and that the inbox file was a separate concept, ostensibly to save "captured notes" into. Could have read the instructions on the MobileOrg website and the emacs org-mobile page a bit more carefully.

That said, in my defense, there are lots of new concepts, some of which to me, at first glance, seem a bit counter-intuitive like:

Anyway, specifically, changed ~/.emacs.d/init.el from

(setq org-directory "[redacted]/repo/typed/")
(setq org-mobile-inbox-for-pull "[redacted]/repo/typed/mobile/mobileorg.org")
(setq org-mobile-directory "[redacted]/repo/typed/mobile")
(setq org-mobile-files (quote ("[redacted]/repo/typed/220212.org")))

to

(setq org-directory "[redacted]/repo/typed/")
(setq org-mobile-inbox-for-pull "[redacted]/repo/typed/inbox-for-pull.org")
(setq org-mobile-directory "[redacted]/repo/typed/mobile")
(setq org-mobile-files (quote ("[redacted]/repo/typed/220212.org")))

Seems to work well with a bit of testing. Still experimenting to see if I want to use MobileOrg extensively, but I am quite optimistic I'll get some use from it. Thanks.

edit: typo