写了个命令来添加 OmniFocus 任务,使用举例如下,先输入任务名后输入备注:
M-x omnifocus-capture RET 看怪奇物语第3季 RET 共8集 RET
代码:
(defun omnifocus-capture (name note)
"Add task to OmniFocus, NAME as the task name and NOTE as the task note."
(interactive "sTask name: \nsTask note: ")
(let ((quote-fn
(lambda (s)
"Quote S for passing as a string to AppleScript."
(mapconcat
(lambda (char)
(pcase char
(?\" (string ?\\ ?\"))
(?\\ (string ?\\ ?\\))
(_ (string char))))
s ""))))
(do-applescript
(format
(concat
"tell front document of application \"Omnifocus\"\n"
" make new inbox task with properties {name:\"%s\", note:\"%s\"}\n"
"end tell")
(funcall quote-fn name)
(funcall quote-fn note)))))