I've recently started using MobileOrg (through Dropbox) to be able to manage my org-mode TODO lists while I'm away from my comput开发者_如何学编程er.
It's generally great, but the syncing back and forth has a few steps, so I'd like to try and simplify it a bit by automating the steps on the PC side.
Anyway, here are the two things I'd like to do:
- Run org-mobile-pushevery time a file is saved, after the save completes. The only thing I use emacs for is org-mode, so this should be fine.
- Run org-mobile-pullon emacs startup.
- Run org-mobile-pullperiodically, say every hour or so.
Thanks.
I don't have Emacs installed on this machine, but here's what you can do:
- http://www.gnu.org/s/emacs/manual/html_node/elisp/Standard-Hooks.html - look for after-save-hook
- Startup things go to your .emacsfile - if you put the call toorg-mobile-pullat the end of this file, you will have it run every time you open Emacs
- Check this SO answer for a periodical run of some function: How to periodically run a task within emacs?
Hope this helps.
Here's what I use
(add-hook 
  'after-save-hook 
  (lambda () 
     (if (string= buffer-file-name "<path to my notes.org>") 
        (org-mobile-push)
     )
  ))
In this reply I've posted code that automatically pulls and then pushes after MobileOrg has synced, and automatically pushes whenever a relevant org file is saved. This makes it fully automatic and you don't have to wait for an hourly period.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论