Open jrbalderrama opened 10 years ago
This is pretty cool -- one question, though, how does 'minor-mode' come in to play here? It seems this relies solely on the file name.
...cj
On 4/3/14 9:38 AM, jrbalderrama wrote:
Currently we should explicitly load org-toodledo (with require '...) in order to use it. Enabling a minor mode we can include a hook and load toodledo on demand. For example, we can set:
(defvar org-toodledo-default-todo-file "/path/to/my/file") (setq org-toodledo-sync-on-save "no")
and then create a function like:
(defun org-toodledo-sync-silently () "Sync a initialized toodledo file with the server on background." (find-file-noselect org-toodledo-default-todo-file) (with-temp-buffer (when (find-buffer-visiting org-toodledo-default-todo-file) (set-buffer (get-file-buffer org-toodledo-default-todo-file)) (org-toodledo-sync) (save-buffer))))
With this function defined (with autoload) we can associate a hook after loading the org-toodledo mode or/and after killing the buffer.
Additionally we can define a cron-like process on Emacs to sync periodically instead of syncing every time we save the file using.
;; sync each 20 min the toodledo file after waiting 5 min. (run-with-timer (* 5 60) (* 20 60) 'org-toodledo-sync-silently)
— Reply to this email directly or view it on GitHub https://github.com/christopherjwhite/org-toodledo/issues/40.
Sorry maybe my explanation isn't clear. If we have a org-toodledo minor mode we can sync the todo list after loading that mode or after killing the buffer (defining those hooks in the minor mode) instead of explicitly call a function or schedule a process to sync periodically. The periodic sync can also be included as well, for convenience, independently.
Aah, yes -- that makes sense. Having a minor mode would also allow definition of default key bindings and probably some other goodies.
...cj
On 4/3/14 11:39 AM, jrbalderrama wrote:
Sorry maybe my explanation isn't clear. If we have a org-toodledo minor mode we can sync the todo list after loading that mode or after killing the buffer (defining those hooks in the minor mode) instead of explicitly call a function or schedule a process to sync periodically. The periodic sync can also be included as well, for convenience, independently.
— Reply to this email directly or view it on GitHub https://github.com/christopherjwhite/org-toodledo/issues/40#issuecomment-39466753.
That's the spirit!
Currently we should explicitly load org-toodledo (with require '...) in order to use it. Enabling a minor mode we can include a hook and load toodledo on demand. For example, we can set:
and then create a function like:
With this function defined (with autoload) we can associate a hook after loading the org-toodledo mode or/and after killing the buffer.
Additionally we can define a cron-like process on Emacs to sync periodically instead of syncing every time we save the file using.