diff options
author | Bastien Guerry <bzg@altern.org> | 2012-12-18 12:16:20 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-12-18 12:16:20 +0100 |
commit | 1af0b39c010a913abec92b51f4a677283ba7ffd2 (patch) | |
tree | f544f16234fa3f372fc106562100f853cec2fcdd | |
parent | 709bf92950fb3e9dd7425e01eb53eedad43c7262 (diff) | |
download | org-mode-1af0b39c010a913abec92b51f4a677283ba7ffd2.tar.gz |
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.
-rw-r--r-- | lisp/org-clock.el | 27 | ||||
-rw-r--r-- | lisp/org.el | 18 |
2 files changed, 25 insertions, 20 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 2b37d7c..8d11b8c 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -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 diff --git a/lisp/org.el b/lisp/org.el index 3f4c319..3c3beeb 100644 --- a/lisp/org.el +++ b/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 () |