1

I have the following code block, which I am trying to execute from org-babel:

#+BEGIN_SRC emacs-lisp

  (let ((h (nth 5 (org-heading-components))))
    (do-applescript (format "tell application \"Calendar\"
       activate
       set s to current date
       set f to s + 30 * minutes
       tell calendar \"activities\"
         make new event with properties {summary:%s, start date:s, end date:f}
       end tell
   end tell" h)))

#+End_SRC

The applescript bit works fine, on its own. But when I run this from org-babel, I get the following error:

Expected expression but found ":".

What am I missing?

2

I figured it out. Line 1 should have used nth 4 not 5, which is why Emacs complained about a :. Also, the %s needs to be quoted. Here is the finished code:

#+BEGIN_SRC emacs-lisp

  (let ((h (nth 4 (org-heading-components))))
    (do-applescript (format "tell application \"Calendar\"
       activate
       set s to current date
       set f to s + 30 * minutes
       tell calendar \"activities\"
         make new event with properties {summary:\"%s\", start date:s, end date:f}
       end tell
   end tell" h)))

#+End_SRC
  • Please accept your own answer. Otherwise, the question will keep getting bumped to the home page now and then, as happened just now. There is a tick mark you click on to accept the answer. – Harald Hanche-Olsen Mar 24 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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