Allow C-S-<up/down> to sync update clock timestamps by several units.
* org-clock.el (org-clock-timestamps-up) (org-clock-timestamps-down, org-clock-timestamps-change): Add an optional argument N to change timestamps by several units. * org.el (org-shiftcontrolup, org-shiftcontroldown): Ditto. Thanks to Rainer Stengele for this idea.
This commit is contained in:
parent
709bf92950
commit
1af0b39c01
|
@ -1553,19 +1553,22 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
|
|||
(move-beginning-of-line 1)
|
||||
(looking-at "^[ \t]*CLOCK:")))
|
||||
|
||||
(defun org-clock-timestamps-up nil
|
||||
"Increase CLOCK timestamps at cursor."
|
||||
(interactive)
|
||||
(org-clock-timestamps-change 'up))
|
||||
(defun org-clock-timestamps-up (&optional n)
|
||||
"Increase CLOCK timestamps at cursor.
|
||||
Optional argument N tells to change by that many units."
|
||||
(interactive "P")
|
||||
(org-clock-timestamps-change 'up n))
|
||||
|
||||
(defun org-clock-timestamps-down nil
|
||||
"Increase CLOCK timestamps at cursor."
|
||||
(interactive)
|
||||
(org-clock-timestamps-change 'down))
|
||||
(defun org-clock-timestamps-down (&optional n)
|
||||
"Increase CLOCK timestamps at cursor.
|
||||
Optional argument N tells to change by that many units."
|
||||
(interactive "P")
|
||||
(org-clock-timestamps-change 'down n))
|
||||
|
||||
(defun org-clock-timestamps-change (updown)
|
||||
(defun org-clock-timestamps-change (updown &optional n)
|
||||
"Change CLOCK timestamps synchronously at cursor.
|
||||
UPDOWN tells whether to change 'up or 'down."
|
||||
UPDOWN tells whether to change 'up or 'down.
|
||||
Optional argument N tells to change by that many units."
|
||||
(setq org-ts-what nil)
|
||||
(when (org-at-timestamp-p t)
|
||||
(let ((tschange (if (eq updown 'up) 'org-timestamp-up
|
||||
|
@ -1581,9 +1584,9 @@ UPDOWN tells whether to change 'up or 'down."
|
|||
(if (<= begts2 (point)) (setq updatets1 t))
|
||||
(if (not ts2)
|
||||
;; fall back on org-timestamp-up if there is only one
|
||||
(funcall tschange)
|
||||
(funcall tschange n)
|
||||
;; setq this so that (boundp 'org-ts-what is non-nil)
|
||||
(funcall tschange)
|
||||
(funcall tschange n)
|
||||
(let ((ts (if updatets1 ts2 ts1))
|
||||
(begts (if updatets1 begts1 begts2)))
|
||||
(setq tdiff
|
||||
|
|
18
lisp/org.el
18
lisp/org.el
|
@ -19222,22 +19222,24 @@ Depending on context, this does one of the following:
|
|||
(org-call-for-shift-select 'backward-word))
|
||||
(t (org-shiftselect-error))))
|
||||
|
||||
(defun org-shiftcontrolup ()
|
||||
"Change timestamps synchronously up in CLOCK log lines."
|
||||
(interactive)
|
||||
(defun org-shiftcontrolup (&optional n)
|
||||
"Change timestamps synchronously up in CLOCK log lines.
|
||||
Optional argument N tells to change by that many units."
|
||||
(interactive "P")
|
||||
(cond ((and (not org-support-shift-select)
|
||||
(org-at-clock-log-p)
|
||||
(org-at-timestamp-p t))
|
||||
(org-clock-timestamps-up))
|
||||
(org-clock-timestamps-up n))
|
||||
(t (org-shiftselect-error))))
|
||||
|
||||
(defun org-shiftcontroldown ()
|
||||
"Change timestamps synchronously down in CLOCK log lines."
|
||||
(interactive)
|
||||
(defun org-shiftcontroldown (&optional n)
|
||||
"Change timestamps synchronously down in CLOCK log lines.
|
||||
Optional argument N tells to change by that many units."
|
||||
(interactive "P")
|
||||
(cond ((and (not org-support-shift-select)
|
||||
(org-at-clock-log-p)
|
||||
(org-at-timestamp-p t))
|
||||
(org-clock-timestamps-down))
|
||||
(org-clock-timestamps-down n))
|
||||
(t (org-shiftselect-error))))
|
||||
|
||||
(defun org-ctrl-c-ret ()
|
||||
|
|
Loading…
Reference in New Issue