From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Spiers Subject: Re: MobileOrg, webdav, correct use of org-mobile-directory? Date: Sun, 19 Aug 2012 00:25:31 +0100 Message-ID: References: <87d32w6cqj.wl%jamshark70@dewdrop-world.net> <29702.1344745760@alphaville> <32411.1344777066@alphaville> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2sOc-0003Ts-Hc for emacs-orgmode@gnu.org; Sat, 18 Aug 2012 19:25:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2sOb-00074y-0J for emacs-orgmode@gnu.org; Sat, 18 Aug 2012 19:25:34 -0400 Received: from mail-bk0-f41.google.com ([209.85.214.41]:37652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2sOa-00072J-LR for emacs-orgmode@gnu.org; Sat, 18 Aug 2012 19:25:32 -0400 Received: by bkcjc3 with SMTP id jc3so1641695bkc.0 for ; Sat, 18 Aug 2012 16:25:31 -0700 (PDT) In-Reply-To: <32411.1344777066@alphaville> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: jamshark70@dewdrop-world.net, emacs-orgmode@gnu.org Hi all, I think some confusion has (quite understandably) arisen in this thread about how the org-mobile + webDAV + tramp + scp combination is supposed to work. At risk of getting it all wrong and looking like a fool, I *think* I can help explain :-) On Sun, Aug 12, 2012 at 2:11 PM, Nick Dokos wrote: > James Harkins wrote: > > For my immediate needs, I think I can do without scp, since org-mode > > and Apache are on the same machine. Correct. > > The broader point is about the > > documentation. It says "do it this way" but "this way" doesn't work. It definitely *can* work (I have it working, finally), but there are various pitfalls - see below. > I read the page on worg and I agree it's unclear: it talks about using > webdav and then does not use webdav at all, just scp. Yes, it's unclear. The reason it talks about webDAV is that this is how the mobile clients (well, Android at least) read and write files. So when it refers to the webDAV directory, it actually means a directory on a server which will be read from and written to by *both* webDAV (on your mobile device) *and* tramp+scp (from emacs on your computer). That was the crux of the confusion described here: http://stackoverflow.com/questions/11486719/orgmode-cant-authenticate-to-webdav-for-mobile-org-push/ so from emacs, you should use your ssh password, even though the intended remote target directory is (also) served via webDAV. For most people, their mobile device cannot reach their computer (e.g. home computer behind a NAT firewall) when roaming, which means that the webDAV server needs to be publically accessible via the internet. In this case, org-mobile-directory should be a tramp path beginning "/scp...". But for other people such as James, the webDAV server runs on the same machine where they edit their org files. In this case, org-mobile-directory can point directly at the path on the local file system, and there is no need to use tramp. > But I don't agree that it does not work: I've done a minimal setup > with scp and tramp and org-mobile-push/pull worked fine for me. I > suspect that you are still having some setup problems as indicated > in my other email. Yes, and I can hazard a guess what it might be, because I just got bitten by a similar issue :-) org-mobile-push was working for me when invoked via emacs run in batch mode from a shell script, but not in my running emacs instance. I noticed that (file-exists-p org-mobile-directory) was returning nil in the running emacs instance, which seemed to imply that org-mobile-directory must refer to a path on the local filesystem, but I knew that must be wrong otherwise it couldn't be working in batch mode. Eventually I had a light bulb moment where I realised that tramp intercepts functions like file-exists-p, which is how the above can return non-nil even for values of org-mobile-directory beginning with "/scp...". As a result I finally traced the answer to a corrupt tramp cache entry. Once I cleared the cache: (setq tramp-cache-data (make-hash-table :test 'equal)) the error Variable `org-mobile-directory' must point to an existing directory finally went away! > > > > org-mobile-directory: /scpc:**user**@localhost:80/webdav/ > > > > > > This looks wrong Yes, it doesn't make sense to use tramp to scp files to localhost :-) > Your other email shows that you figured this out. > > > 2. This destination is modeled on the docs, so if it's wrong, then so is the doc. > > Not really: the destination in the doc does not specify the port (80). > That's the HTTP port, so scp won't work with that - that's what I picked > up when I said it looked wrong. It needs the sshd port (22 by default > and implied if you leave it out of the scp path in tramp). Right, but scp'ing to localhost doesn't make sense. He should just use the normal local filesystem path instead and skip tramp. > > > Where does org-mobile-directory point to if not the "physical location > > > of the webdav share"? The tramp stuff doesn't know or care about webdav > > > at all: it is just the mechanism that copies files from your local > > > machine to some other machine, so it needs to know exactly where to copy > > > it to. > > > > Well, it almost looks to me like org-mobile-directory is asked to > > do two things at once: specify the scp syntax *and* hold a path > > that can be resolved on the local file system. This is the source > > of my confusion. Hopefully by now I've cleared that up for you :-) It can *either* be an scp/tramp reference to a remote location, or a normal path to a local location. It's never expected to be both at once :-) > You mean the "remote file system" I think, but that's true: it does > specify the protocol (scp) and the path. I think your confusion is that > you also wanted it to be the webdav path and it just cannot be that. In his case, there is no remote, because his Apache/webDAV server is on the local machine. > > At best, the docs are unclear. > > Yup. > > > No matter for me. I'll just set org-mobile-directory to the > > physical, local path that is remotely accessible by webdav. But the > > doc was rather misleading, suggesting that some editorial attention > > would be warranted. > > Amen to that. Agreed. If at least one person lets me know that my explanations above make sense, I might find some time to tweak the FAQ accordingly.