|Subject:||Re: [O] export to ics a specific buffer every X hours|
|Date:||Thu, 25 Aug 2016 10:32:54 +0300|
You have _two_ concerns here. First is what to do when you save
"meetings.org", second is what to do every half hour. Your code
handles both of them, essentially correctly, but in the wrong place.
On 13 July 2016 at 09:41, Xebar Saram <address@hidden> wrote:
> i do have this now
> (defun z/save-meeting-to-ics ()
> "If the current file is in '~/.dotfiles', the code blocks are tangled"
> (when (equal (buffer-file-name)
> (expand-file-name "/home/zeltak/org/files/
agenda/meetings.org"))This means the code will only execute if the current buffer is
"meetings.org" when it executes. That _is_ what you want when you save
meetings.org, but it _is not_ what you want when the timer executes.
Break out the body of the `when' form into its own function, and call
that function from the timer, instead of `z/save-meeting-to-ics'.
> (rename-file (org-icalendar-export-to-ics)
export/kcal.ics")For this, you need to add `z/save-meeting-to-ics' to the Emacs global
> (message "exported to ics")))
> ;;run every 30 minutes
> (run-with-timer 0 (* 30 60) 'z/save-meeting-to-ics)
> ;;(run-with-idle-timer 600 t #'org-agenda-redo) ;; to rebuild it every 600
> ;; (add-hook 'after-save-hook #'z/save-meeting-to-ics)
> yet i cant get the ics file to be created niether when i save the
> meeting.org file
variable `after-save-hook' using function `add-hook'.
> nor every 600 seconds.
You mean 1800 seconds, I think.
> what am i missing here?
> On Sun, Jun 26, 2016 at 9:49 PM, Philip Hudson <address@hidden>
>> On 26 June 2016 at 16:38, Xebar Saram <address@hidden> wrote:
>> > Hi all
>> > so i have pathetic coding skill but managed somehow to come up with this
>> > (defun z/save-meeting-to-ics ()
>> > "If the current file is in '~/.dotfiles', the code blocks are
>> > tangled"
>> > (when (equal (buffer-file-name)
>> > (expand-file-name
>> > "/home/zeltak/org/files/
>> > (org-icalendar-export-to-ics)
>> > (message "exported to ics")))
>> > this does save the org file "meetings.org" to an ICS file in the same
>> > folder
>> > as the file. but i want to do 2 additional things:
>> > 1)save the resulting ICS file to a different directory
>> > 2)run this function every X hours (lets say every 2 hours)
>> > any clue guys?
>> > thx!
>> > Z
>> For 1), change:
>> to something like this:
>> (rename-file (org-icalendar-export-to-ics) your-preferred-pathname)
>> For 2), evaluate this:
>> (info "(elisp) Timers")
>> Phil Hudson http://hudson-it.ddns.net
>> @UWascalWabbit PGP/GnuPG ID: 0x887DCA63
Phil Hudson http://hudson-it.ddns.net
@UWascalWabbit PGP/GnuPG ID: 0x887DCA63
|[Prev in Thread]||Current Thread||[Next in Thread]|