Skip to content

Commit 1f28748

Browse files
committed
1 parent aef479c commit 1f28748

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

emacs/lib/org-pomodoro.el

+23-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Arthur Leonard Andersen <[email protected]>, Marcin Koziej <marcin at lolownia dot org>
44
;; URL: https://github.com/lolownia/org-pomodoro
55
;; Created: May 10, 2013
6-
;; Version: 2.1.0
6+
;; Version: 2.1.0-FL001
77
;; Package-Requires: ((alert "0.5.10") (cl-lib "0.5"))
88

99
;; This file is free software; you can redistribute it and/or modify
@@ -579,6 +579,28 @@ kill the current timer, this may be a break or a running pomodoro."
579579
(call-interactively 'org-clock-in))))
580580
(org-pomodoro-start :pomodoro)))
581581

582+
;;
583+
;; Tip from: https://emacs.stackexchange.com/a/62338/17985
584+
;;
585+
(defun ndk/org-set-effort-in-pomodoros (&optional n)
586+
"This `fn` facilitate to define efforts in tasks in pomodoros units.
587+
588+
You can use interactively by typing `C-c C-x e` or by sending parameter as `M-3 C-c C-x e`."
589+
(interactive "P")
590+
(setq n (or n (string-to-number (read-from-minibuffer "How many pomodoros? " nil nil nil nil "1" nil))))
591+
(let* ((mins-per-pomodoro (if org-pomodoro-length
592+
org-pomodoro-length
593+
25)))
594+
(org-set-effort nil (org-duration-from-minutes (* n mins-per-pomodoro)))))
595+
596+
;;
597+
;; Redefine the key binding `C-c C-x e' which was originally bound to `org-set-effort'
598+
;; to the pomodoro function
599+
;;
600+
;; See also `ndk/org-set-effort-in-pomodoros` fn for more info.
601+
;;
602+
(define-key org-mode-map (kbd "C-c C-x e") #'ndk/org-set-effort-in-pomodoros)
603+
582604
(provide 'org-pomodoro)
583605

584606
;;; org-pomodoro.el ends here

0 commit comments

Comments
 (0)