Function: org-clock-jump-to-current-clock

org-clock-jump-to-current-clock is a byte-compiled function defined in org-clock.el.gz.

Signature

(org-clock-jump-to-current-clock &optional EFFECTIVE-CLOCK)

Documentation

When an Org clock is running, jump to it.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-clock.el.gz
(defun org-clock-jump-to-current-clock (&optional effective-clock)
  "When an Org clock is running, jump to it."
  (let ((drawer (org-clock-into-drawer))
	(clock (or effective-clock (cons org-clock-marker
					 org-clock-start-time))))
    (unless (marker-buffer (car clock))
      (user-error "No Org clock is currently running"))
    (org-with-clock clock (org-clock-goto))
    (with-current-buffer (marker-buffer (car clock))
      (goto-char (car clock))
      (when drawer
	(org-with-wide-buffer
	 (let ((drawer-re (format "^[ \t]*:%s:[ \t]*$"
				  (regexp-quote (if (stringp drawer) drawer "LOGBOOK"))))
	       (beg (save-excursion (org-back-to-heading t) (point))))
	   (catch 'exit
	     (while (re-search-backward drawer-re beg t)
	       (let ((element (org-element-at-point)))
		 (when (org-element-type-p element 'drawer)
		   (when (> (org-element-end element) (car clock))
		     (org-fold-hide-drawer-toggle 'off nil element))
		   (throw 'exit nil)))))))))))