默认的pomodoro是把时间信息写在状态栏上,有时我专注干活根本看不到已经到时了(虽然有声音可听到,但我不总是插着音响或耳机啊。专注的时候甚至角落里的一闪而过的桌面通知都不会去看)。
所以我想能不能在到时后直接在当前的window中自动新建一个buffer同时写出信息,过几秒后自动关闭buffer? Emacs Wiki里有这样几句代码,我乍一看好像是我想要的功能,奈何我lisp学的不好,不知道怎么hack,求高手指点:
(defun pomodoro-message (msg)
"Display a message in a buffer and maybe raise emacs frame."
(when pomodoro-raise-frame
(raise-frame (selected-frame)))
(let ((this-window (selected-window)))
(with-current-buffer (get-buffer-create pomodoro-buffer-name)
(erase-buffer)
(insert msg))
(pop-to-buffer pomodoro-buffer-name)
;; suggest not to change window height, since it will distract users' work environment
;;(fit-window-to-buffer)
;; auto kill the buffer, after some wait
(run-at-time "5 sec" nil 'kill-buffer pomodoro-buffer-name)
(select-window this-window))
(run-hook-with-args 'pomodoro-message-hook msg))