1

I'm still very new to emacs and currently use it on the terminal to track my work time in org-mode.

** Save the world
:LOGBOOK:
CLOCK: [2019-02-14 Do 10:24]
CLOCK: [2019-02-14 Do 08:51]--[2019-02-14 Do 09:28] =>  0:37

How could I make it display the currently running time record in a different color or bold to make it more visible? I'm aware that I can also see the current task in the status line.

2
  • You can make something bold by just putting it between asterisks, like this. Does that work for you?
    – Jesse
    Commented Feb 14, 2019 at 16:07
  • @jesse I'm looking for a color scheme option or something like a style rule in the color scheme that matches only the currently active time record line. So that would not work for me. Thank you though!
    – djangonaut
    Commented Feb 14, 2019 at 18:52

2 Answers 2

2

The following code puts an overlay with red bold face on the running clock whenever you call org-clock-in. It removes the overlay when you call org-clock-out.

I am not entirely sure whether that is the right thing for you since the LOGBOOK drawer is not shown by default. But the code could easily be adapted such that the overlay is put on the heading with running clock.

(require 'org-element)
(require 'org-clock)

(defvar org-clock-running-ol nil
  "Overlay for the running clock.")

(defface org-clock-running-face
  '((t :foreground "Red" :weight bold))
  "Face for highlighting the running clock.")

(defun org-clock-add-running-ol ()
  "Highlight the running clock."
  (save-excursion
    (when (org-clock-is-active)
      (org-clock-remove-running-ol)
      (goto-char org-clock-marker)
      (setq org-clock-running-ol (make-overlay (point) (scan-sexps (point) -1)))
      (overlay-put org-clock-running-ol 'face 'org-clock-running-face)
      )))

(defun org-clock-remove-running-ol ()
  (when (overlayp org-clock-running-ol)
    (delete-overlay org-clock-running-ol)
    (setq org-clock-running-ol nil)))

(add-hook 'org-clock-in-hook #'org-clock-add-running-ol)
(add-hook 'org-clock-out-hook #'org-clock-remove-running-ol)
1
  • Wow, just works. Since I unfold all folds in evil mode with zR it's ok for me like this and I can use it as a base to learn more myself.
    – djangonaut
    Commented Feb 15, 2019 at 15:52
0

I think changing the color for org-clock-overlay is what you are looking for.

Just M-xlist-faces-display RET to see a list with all the faces. Search for org-clock-overlay and customize it the way you want.

1
  • I have tried that but it changes the color of all time records, including the ones that have finished/have an end time. I want only the active one, the one that is missing an end time. However, I'm quite astonished what nice UI emacs gives me to edit the theme. :)
    – djangonaut
    Commented Feb 14, 2019 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.