Skip to main content
1 of 3

Assign a function with universal argument to a key (org-start-timer)

I would like to assing the function org-timer-start with a univerals argument to its own key.

I read here, that one should look into the source code of a function to find out how to pass a universal argument.

Where is this part in the following function, that tells me about the universal argument call?

(defun org-timer-start (&optional offset)
  "Set the starting time for the relative timer to now.
When called with prefix argument OFFSET, prompt the user for an offset time,
with the default taken from a timer stamp at point, if any.
If OFFSET is a string or an integer, it is directly taken to be the offset
without user interaction.
When called with a double prefix arg, all timer strings in the active
region will be shifted by a specific amount.  You will be prompted for
the amount, with the default to make the first timer string in
the region 0:00:00."
  (interactive "P")
  (cond
   ((equal offset '(16))
    (call-interactively 'org-timer-change-times-in-region))
   (org-timer-countdown-timer
    (user-error "Countdown timer is running.  Cancel first"))
   (t
    (let (delta def s)
      (if (not offset)
      (setq org-timer-start-time (current-time))
    (cond
     ((integerp offset) (setq delta offset))
     ((stringp offset) (setq delta (org-timer-hms-to-secs offset)))
     (t
      (setq def (if (org-in-regexp org-timer-re)
            (match-string 0)
              "0:00:00")
        s (read-string
           (format "Restart timer with offset [%s]: " def)))
      (unless (string-match "\\S-" s) (setq s def))
      (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
    (setq org-timer-start-time (org-time-since delta)))
      (setq org-timer-pause-time nil)
      (org-timer-set-mode-line 'on)
      (message "Timer start time set to %s, current value is %s"
           (format-time-string "%T" org-timer-start-time)
           (org-timer-secs-to-hms (or delta 0)))
      (run-hooks 'org-timer-start-hook)))))

Do I need to make a custom fuction to call org-timer-start with a Ctrl-u prefix?