1

I manually export my agenda year-view periodically to ics and upload it to my site, where it is subscribed by google calendar. It works; but it takes enough time to draw a year view and export it to ics, I'd like to do this automatically via a bash script. How can I do this? Right now I do it manually in emacs as follows:

M-x agenda

vy

C-wcal.ics

and then run my upload script.

2
  • Instead of writing a bash script you might want to consider automating the task in Emacs. You have two options for that: 1. Record a keyboard macro and bind it to a key. (After all, "Emacs" stands for "Editing macros".) 2. Define a custom command (i.e., an interactive function) and bind that to a key. // This reduces the overall workflow to 1. Press key binding for macro/command in Emacs. 2. Run upload script.
    – itsjeyd
    May 19, 2014 at 7:22
  • Good suggestion; thanks. But there are two reasons I don't take that route: first, the agenda commands are process-consuming and I would like to run them in a separate emacs instance (which would add one more step to a manual solution); and I would like to have them run perhaps via Cron during pre-set idle times. May 19, 2014 at 11:37

2 Answers 2

5

Are you trying to create an icalendar file, or just write your year agenda out? To write icalendar file out for the year:

emacs --batch --user $USER --eval "(progn (org-agenda-list nil nil 'year) (org-icalendar-combine-agenda-files))"

will put it in ~/org.ics If you just want to capture the year agenda as text, what junaleon writes does it.

1
  • Nice catch; I hadn't noticed the format of the output with JuanLeon's answer. This does it. May 20, 2014 at 9:20
3

This shell command will generate the ICal file for a year based on your agenda data:

emacs --batch --user $USER --eval "(progn (org-agenda-list nil nil 'year) (write-file \"cal.ics\"))"
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.