Adapt clock funtion
This commit is contained in:
parent
2cab09f8fe
commit
ee3c5f2a1b
18
org.el
18
org.el
@ -6,8 +6,10 @@
|
|||||||
|
|
||||||
(require 'org)
|
(require 'org)
|
||||||
|
|
||||||
|
(defvar org-clock-heading-str-limit 20
|
||||||
|
"Maximum length of `org-clock-heading' string. Will be truncated if too long.")
|
||||||
(defun max/org-clock-get-clock-string ()
|
(defun max/org-clock-get-clock-string ()
|
||||||
"Form a clock string that will be shown in polybar.
|
"Form a clock string that will be shown in a status bar.
|
||||||
Adapted from `org-clock-get-clock-string'."
|
Adapted from `org-clock-get-clock-string'."
|
||||||
(require 'org-clock)
|
(require 'org-clock)
|
||||||
(when (org-clocking-p)
|
(when (org-clocking-p)
|
||||||
@ -15,17 +17,21 @@ Adapted from `org-clock-get-clock-string'."
|
|||||||
(floor (org-time-convert-to-integer
|
(floor (org-time-convert-to-integer
|
||||||
(time-since org-clock-start-time))
|
(time-since org-clock-start-time))
|
||||||
60))
|
60))
|
||||||
|
(org-clock-heading-str (if (> (length org-clock-heading) org-clock-heading-str-limit)
|
||||||
|
(concat (substring org-clock-heading 0 org-clock-string-limit) "...")
|
||||||
|
org-clock-heading))
|
||||||
(clocked-time (org-clock-get-clocked-time))
|
(clocked-time (org-clock-get-clocked-time))
|
||||||
|
(work-done-str (org-duration-from-minutes clocked-time))
|
||||||
(current-work-done-str (org-duration-from-minutes currently-clocked-time)))
|
(current-work-done-str (org-duration-from-minutes currently-clocked-time)))
|
||||||
(if org-clock-effort
|
(if org-clock-effort
|
||||||
(let* ((effort-in-minutes (org-duration-to-minutes org-clock-effort))
|
(let* ((effort-in-minutes (org-duration-to-minutes org-clock-effort))
|
||||||
(work-done-str (org-duration-from-minutes clocked-time))
|
|
||||||
(effort-str (org-duration-from-minutes effort-in-minutes)))
|
(effort-str (org-duration-from-minutes effort-in-minutes)))
|
||||||
(format "%s (%s/%s) %s"
|
(format "%s (%s/%s) %s"
|
||||||
current-work-done-str work-done-str effort-str org-clock-heading))
|
org-clock-heading-str work-done-str effort-str current-work-done-str))
|
||||||
(format "%s %s"
|
(format "%s (%s) %s"
|
||||||
current-work-done-str
|
org-clock-heading
|
||||||
org-clock-heading)))))
|
work-done-str
|
||||||
|
current-work-done-str)))))
|
||||||
|
|
||||||
;; Fix org-babel shell block not inheriting envrc
|
;; Fix org-babel shell block not inheriting envrc
|
||||||
;; https://github.com/purcell/envrc/issues/28
|
;; https://github.com/purcell/envrc/issues/28
|
||||||
|
Loading…
x
Reference in New Issue
Block a user