Function: org-clock-insert-selection-line

org-clock-insert-selection-line is a byte-compiled function defined in org-clock.el.gz.

Signature

(org-clock-insert-selection-line I MARKER)

Documentation

Insert a line for the clock selection menu.

And return a cons cell with the selection character integer and the marker pointing to it.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-clock.el.gz
(defun org-clock-insert-selection-line (i marker)
  "Insert a line for the clock selection menu.
And return a cons cell with the selection character integer and the marker
pointing to it."
  (when (marker-buffer marker)
    (let (cat task heading prefix)
      (with-current-buffer (org-base-buffer (marker-buffer marker))
	(org-with-wide-buffer
	 (ignore-errors
	   (goto-char marker)
	   (setq cat (org-get-category)
		 heading (org-get-heading 'notags)
		 prefix (save-excursion
			  (org-back-to-heading t)
			  (looking-at org-outline-regexp)
			  (match-string 0))
		 task (substring
		       (org-fontify-like-in-org-mode
			(concat prefix heading)
			org-odd-levels-only)
		       (length prefix))))))
      (when (and cat task)
        (if (string-match-p "[[:print:]]" (make-string 1 i))
	    (insert (format "[%c] %-12s  %s\n" i cat task))
          ;; Avoid non-printable characters.
          (insert (format "[N/A] %-12s  %s\n" cat task)))
	(cons i marker)))))