Re: [O] auto-push to mobile (but only when editing org buffer)

2012-08-17 Thread Ken Mankoff
On Thu, Aug 16, 2012 at 2:54 PM, Ken Mankoff  wrote:
> Hi Marcel,
>
> On Wed, Aug 15, 2012 at 12:33 AM, Marcel van der Boom  
> wrote:
>> Perhaps you will find https://gist.github.com/3111823 interesting. It
>> contains a bit of code to do the org-mobile-push asynchronously (and
>> notify me about it when done). This makes the push work in the
>> background, in my case it can take quite a while, and not interfere
>> with normal usage.
>>
>
> That is a very useful snippet. Thank you for sharing.
>
>-k.

It took a bit of work to get that snippet working on my system, but it
works well now. On the flip side, the following watches for incoming
changes and automagically calls org-mobile-pull when needed...

;; http://stackoverflow.com/questions/3456782/emacs-lisp-how-to-monitor-ch$
(defun install-monitor (file secs)
  (run-with-timer
   0 secs
   (lambda (f p)
 (unless (< p (second (time-since (elt (file-attributes f) 5
   ;(message "File %s changed!" f)))
   (org-mobile-pull)))
   file secs))
(defvar monitor-timer (install-monitor "~/Dropbox/MobileOrg/mobileorg.org"$
  "Check if file changed every 30 s.")

  -k.



Re: [O] auto-push to mobile (but only when editing org buffer)

2012-08-16 Thread Ken Mankoff
Hi Marcel,

On Wed, Aug 15, 2012 at 12:33 AM, Marcel van der Boom  wrote:
> Perhaps you will find https://gist.github.com/3111823 interesting. It
> contains a bit of code to do the org-mobile-push asynchronously (and
> notify me about it when done). This makes the push work in the
> background, in my case it can take quite a while, and not interfere
> with normal usage.
>

That is a very useful snippet. Thank you for sharing.

   -k.



Re: [O] auto-push to mobile (but only when editing org buffer)

2012-08-15 Thread Marcel van der Boom

On di 14-aug-2012 19:10
Ken Mankoff  wrote:

>
>>> How can I wrap that to only run when the active buffer is in Org 
>>> Mode?
>>
>> (run-at-time "00:10" 10 (lambda () (if (eq major-mode 'org-mode) 
>> (org-mobile-push
>
>That works well. After reading run-at-time documentation, the 
>"00:10" isn't ideal. I now use the following, which syncs files 
>every 60 seconds starting 1 minute after launching emacs:
>
>(run-at-time "1 min" 60 (lambda () (if (eq major-mode
>'org-mode)(org-mobile-push
>

Perhaps you will find https://gist.github.com/3111823 interesting. It
contains a bit of code to do the org-mobile-push asynchronously (and
notify me about it when done). This makes the push work in the
background, in my case it can take quite a while, and not interfere
with normal usage.

marcel

-- 
Marcel van der Boom  -- http://hsdev.com/mvdb.vcf
HS-Development BV-- http://www.hsdev.com
We use bitcoin!  -- http://bitcoin.org


smime.p7s
Description: S/MIME cryptographic signature


Re: [O] auto-push to mobile (but only when editing org buffer)

2012-08-14 Thread Ken Mankoff


How can I wrap that to only run when the active buffer is in Org 
Mode?


(run-at-time "00:10" 10 (lambda () (if (eq major-mode 'org-mode) 
(org-mobile-push


That works well. After reading run-at-time documentation, the 
"00:10" isn't ideal. I now use the following, which syncs files 
every 60 seconds starting 1 minute after launching emacs:


(run-at-time "1 min" 60 (lambda () (if (eq major-mode 
'org-mode)(org-mobile-push

Thanks,

  -k.



Re: [O] auto-push to mobile (but only when editing org buffer)

2012-08-14 Thread Bastien
Hi Ken,

Ken Mankoff  writes:

> How can I wrap that to
> only run when the active buffer is in Org Mode?

(run-at-time "00:10" 10 (lambda () (if (eq major-mode 'org-mode) 
(org-mobile-push

HTH,

-- 
 Bastien



[O] auto-push to mobile (but only when editing org buffer)

2012-08-14 Thread Ken Mankoff
I'm trying to set up auto-pushing via org-mobile-push to make org-mode
work more seamlessly with the iPhone. I have the following in my
.emacs:

(run-at-time "00:10" 10 'org-mobile-push)

which is running org-mobile-push every 10 seconds. This is for
testing. I'll reduce it to every 5 minutes once I'm done testing. But
it runs even when I'm just editing ~/.emacs. How can I wrap that to
only run when the active buffer is in Org Mode?

Thanks,

   -k.