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?

1 Answer 1

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
1
  • 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. Mar 24, 2019 at 9:21

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.