emacs - 如何让 Emacs org-mode 在 DONE 状态下播放声音文件?

标签 emacs org-mode audio aquamacs

当我更改 TODO 的状态时,我希望 org-mode 通过播放美妙的声音来奖励我完成任务。项目至 DONE .

我在我的 .emacs 中尝试了两种变体文件,没有一个工作。我在 OSX 上使用 Aquamacs。

这些都不起作用:

'(org-after-todo-state-change-hook (quote (org-clock-out-if-current) (play-sound-file "~/Library/Sounds/InkSoundStroke3.aif")))

'(org-after-todo-state-change-hook (quote (org-clock-out-if-current)     (start-process-shell-command "afplay" nil "mplayer ~/Library/Sounds/InkSoundStroke3.aif")))

最佳答案

编辑:如果您检查钩子(Hook)的文档字符串 (C-hv org-after-todo-state-change-hook RET),您将看到新状态在变量 org-state 中可用,所以我们可以测试一下:

(add-hook 'org-after-todo-state-change-hook 'my-org-after-todo-state-change)
(defun my-org-after-todo-state-change ()
  (when (string-equal org-state "DONE")
    (org-clock-out-if-current)
    (play-sound-file "~/Library/Sounds/InkSoundStroke3.aif")))

关于emacs - 如何让 Emacs org-mode 在 DONE 状态下播放声音文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15345614/

相关文章:

android - Android麦克风输入灵敏度

emacs - elisp 函数替换选择

go - 使用 Flyspell-prog-mode 和 go-autocomplete

matlab - 如何在组织模式下在同一文件中定义matlab函数

Emacs 斜体组织模式

audio - ffmpeg 录制多源音频

安卓媒体播放器 : Download to File and Stream From File

emacs - 相当于 CLI 上 Emacs 中的 GUI "Quick Open"?

php - Emacs php 模式和 paredit

firefox - 如何使 org-protocol 在 Openbox 上工作?