-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclockifun.el
More file actions
74 lines (55 loc) · 1.97 KB
/
clockifun.el
File metadata and controls
74 lines (55 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;;; clockifun.el --- Clockify-cli emacs org-mode !!no usar
;; Copyright (C) 2020-2023 Jovany Leandro G.C <bit4bit@riseup.net>
;; Maintainer: Jovany Leandro G.C <bit4bit@riseup.net>
;; Version: 0.1.0
;;no usar clockify, pero en caso contrario
(require 'org-clock)
(require 'clockifylib)
(defcustom clockifun-stopwatcher nil
"select the stopwatch provider"
:type 'function
:group 'clockifun)
(defun clockifun-stopwatcher->init (plugin)
"Parameter 'init of PLUGIN."
(plist-get plugin 'init))
(defun clockifun-stopwatcher->in (plugin)
"Parameter 'in of PLUGIN."
(plist-get plugin 'in))
(defun clockifun-stopwatcher->out (plugin)
"Parameter 'out of PLUGIN."
(plist-get plugin 'out))
(defun clockifun-stopwatcher->project-put (plugin)
"Parameter 'out of PLUGIN."
(plist-get plugin 'project-put))
(defun strings-join (strings sep)
"string concatenate"
(mapconcat (lambda (v) v) strings sep))
(defun clockifun-project-put ()
"Insert property CLOCKIFY-PROJECT in org entry."
(interactive)
(funcall
(clockifun-stopwatcher->project-put (funcall clockifun-stopwatcher))))
(defun clockifun-enable ()
"enable clockifun org-mode"
(interactive)
(unless clockifun-stopwatcher
(error "Please configure variable clockifun-stopwatcher"))
(let* ((plugin (funcall clockifun-stopwatcher)))
(funcall (clockifun-stopwatcher->init plugin))
(add-hook 'org-clock-in-hook (clockifun-stopwatcher->in plugin))
(add-hook 'org-clock-out-hook (clockifun-stopwatcher->out plugin))
)
(message "enabled clockifun"))
(defun clockifun-disable ()
"disable clockifun org-mode"
(interactive)
(let* ((plugin (funcall clockifun-stopwatcher))
(hook-in (clockifun-stopwatcher->in plugin))
(hook-out (clockifun-stopwatcher->out plugin)))
(when hook-in
(remove-hook 'org-clock-in-hook hook-in))
(when hook-out
(remove-hook 'org-clock-out-hook hook-out)))
(message "disabled clockifun"))
(provide 'clockifun)
;;; clockifun.el ends here