* auto-push to mobile (but only when editing org buffer)
@ 2012-08-15 1:04 Ken Mankoff
2012-08-15 1:36 ` Bastien
0 siblings, 1 reply; 6+ messages in thread
From: Ken Mankoff @ 2012-08-15 1:04 UTC (permalink / raw
To: emacs-orgmode
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: auto-push to mobile (but only when editing org buffer)
2012-08-15 1:04 auto-push to mobile (but only when editing org buffer) Ken Mankoff
@ 2012-08-15 1:36 ` Bastien
2012-08-15 2:10 ` Ken Mankoff
0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2012-08-15 1:36 UTC (permalink / raw
To: Ken Mankoff; +Cc: emacs-orgmode
Hi Ken,
Ken Mankoff <mankoff@gmail.com> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: auto-push to mobile (but only when editing org buffer)
2012-08-15 1:36 ` Bastien
@ 2012-08-15 2:10 ` Ken Mankoff
2012-08-15 7:33 ` Marcel van der Boom
0 siblings, 1 reply; 6+ messages in thread
From: Ken Mankoff @ 2012-08-15 2:10 UTC (permalink / raw
To: Bastien; +Cc: emacs-orgmode
>> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: auto-push to mobile (but only when editing org buffer)
2012-08-15 2:10 ` Ken Mankoff
@ 2012-08-15 7:33 ` Marcel van der Boom
2012-08-16 21:54 ` Ken Mankoff
0 siblings, 1 reply; 6+ messages in thread
From: Marcel van der Boom @ 2012-08-15 7:33 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
On di 14-aug-2012 19:10
Ken Mankoff <mankoff@gmail.com> 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
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5620 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: auto-push to mobile (but only when editing org buffer)
2012-08-15 7:33 ` Marcel van der Boom
@ 2012-08-16 21:54 ` Ken Mankoff
2012-08-17 22:53 ` Ken Mankoff
0 siblings, 1 reply; 6+ messages in thread
From: Ken Mankoff @ 2012-08-16 21:54 UTC (permalink / raw
To: Marcel van der Boom; +Cc: emacs-orgmode
Hi Marcel,
On Wed, Aug 15, 2012 at 12:33 AM, Marcel van der Boom <marcel@hsdev.com> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: auto-push to mobile (but only when editing org buffer)
2012-08-16 21:54 ` Ken Mankoff
@ 2012-08-17 22:53 ` Ken Mankoff
0 siblings, 0 replies; 6+ messages in thread
From: Ken Mankoff @ 2012-08-17 22:53 UTC (permalink / raw
To: Marcel van der Boom; +Cc: emacs-orgmode
On Thu, Aug 16, 2012 at 2:54 PM, Ken Mankoff <mankoff@gmail.com> wrote:
> Hi Marcel,
>
> On Wed, Aug 15, 2012 at 12:33 AM, Marcel van der Boom <marcel@hsdev.com> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-08-17 22:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-15 1:04 auto-push to mobile (but only when editing org buffer) Ken Mankoff
2012-08-15 1:36 ` Bastien
2012-08-15 2:10 ` Ken Mankoff
2012-08-15 7:33 ` Marcel van der Boom
2012-08-16 21:54 ` Ken Mankoff
2012-08-17 22:53 ` Ken Mankoff
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.