Emacs 番茄钟 pomidor

Windows 10

pomidor:https://github.com/TatriX/pomidor

alert :https://github.com/jwiegley/alert

toaster:https://github.com/nels-o/toaster

在Emacs里可以使用番茄工作法,这里用的是pomidor,因为这个可以记录一共用了多少个番茄钟。

当25分钟到了之后可以用声音和弹出框进行提示,声音文件可以自定义,弹出框默认是在minibuffer里显示,当然也是可以用其他更醒目的方式的,例如toaster。

toaster下载后需要添加到操作系统的环境变量PATH里,在Path后面加上:

F:\home\toaster\toast\bin\Release

根据实际情况更改位置。

以下是配置:

;;; init-pomidor.el --- pomidor
;;; https://github.com/TatriX/pomidor
;;; Commentary:
;;; Code:

(use-package pomidor
  :ensure t
  :defer t
  :init
  (global-set-key "\M-p" #'pomidor)
  :config
  (setq
   ;;pomidor-sound-tick nil ;; nil取消声音
   ;;pomidor-sound-tack nil ;; nil取消声音
   pomidor-sound-tick (expand-file-name (concat (getenv "HOME") "/myemacs/resource/tick.wav"))
   pomidor-sound-tack (expand-file-name (concat (getenv "HOME") "/myemacs/resource/tack.wav"))
   pomidor-sound-overwork (expand-file-name (concat (getenv "HOME") "/myemacs/resource/ring.wav"))
   pomidor-sound-break-over (expand-file-name (concat (getenv "HOME") "/myemacs/resource/rest.wav"))
   )

  ;; log
  ;; https://github.com/TatriX/pomidor/issues/20
  (defadvice pomidor-stop (before pomidor-save-log activate)
    "Log pomidor data to the ~/pomidor-log.csv file.
     Columns: date,work,overwork,break"
    (write-region (format "%s,%d,%d,%d\n"
                          (format-time-string "%Y/%m/%d")
                          (/ (time-to-seconds (pomidor-work-duration)) 60)
                          (/ (time-to-seconds (or (pomidor-overwork-duration) 0)) 60)
                          (/ (time-to-seconds (or (pomidor-break-duration) 0)) 60))
                  nil
                  "~/pomidor-log.csv"
                  'append))

  (cond
   ((eq system-type 'windows-nt)
    (setq alert-default-style 'toaster)
    )
   ((eq system-type 'gnu/linux)
    (setq alert-default-style 'libnotify)
    ))
  )
(provide 'init-pomidor)
;;; init-pomidor.el ends here

-- END --

猜你喜欢

转载自www.cnblogs.com/ibgo/p/10229891.html