Bind `org-clock-in-last' to C-c C-x C-x and ̀org-clock-cancel' to C-c C-x C-q.
* org.el (org-flag-drawer): Add a docstring. (org-mode-map): Bind ̀org-clock-cancel' to "C-cC-xC-q" and `org-clock-in-last' to "C-cC-xC-x". This fixes a bug in the previous keybinding for `org-clock-in-last', which would override the one for `org-clock-in'. * org-clock.el (org-clock-in-last): Prevent errors when there is no clocking history. (org-clock-cancel): Fix bug when checking against a clock log in a folded drawer. Thanks to Bernt Hansen who reported the problem.
This commit is contained in:
parent
ef3d4b5965
commit
fea1b82bef
|
@ -1264,10 +1264,12 @@ last clock-out time, if any."
|
||||||
(let ((start-time (if (or org-clock-continuously (equal arg '(16)))
|
(let ((start-time (if (or org-clock-continuously (equal arg '(16)))
|
||||||
(or org-clock-out-time (current-time))
|
(or org-clock-out-time (current-time))
|
||||||
(current-time))))
|
(current-time))))
|
||||||
(org-clock-clock-in (list (car org-clock-history)) nil start-time)
|
(if (null org-clock-history)
|
||||||
(message "Now clocking in: %s (in %s)"
|
(message "No last clock")
|
||||||
org-clock-current-task
|
(org-clock-clock-in (list (car org-clock-history)) nil start-time)
|
||||||
(buffer-name (marker-buffer org-clock-marker))))))
|
(message "Clocking back: %s (in %s)"
|
||||||
|
org-clock-current-task
|
||||||
|
(buffer-name (marker-buffer org-clock-marker)))))))
|
||||||
|
|
||||||
(defun org-clock-mark-default-task ()
|
(defun org-clock-mark-default-task ()
|
||||||
"Mark current task as default task."
|
"Mark current task as default task."
|
||||||
|
@ -1560,8 +1562,7 @@ UPDOWN tells whether to change 'up or 'down."
|
||||||
(save-excursion ; Do not replace this with `with-current-buffer'.
|
(save-excursion ; Do not replace this with `with-current-buffer'.
|
||||||
(org-no-warnings (set-buffer (org-clocking-buffer)))
|
(org-no-warnings (set-buffer (org-clocking-buffer)))
|
||||||
(goto-char org-clock-marker)
|
(goto-char org-clock-marker)
|
||||||
(if (save-excursion (move-beginning-of-line 1)
|
(if (looking-back (concat "^[ \t]*" org-clock-string ".*"))
|
||||||
(looking-at (concat "^[ \t]*" org-clock-string)))
|
|
||||||
(progn (delete-region (1- (point-at-bol)) (point-at-eol))
|
(progn (delete-region (1- (point-at-bol)) (point-at-eol))
|
||||||
(org-remove-empty-drawer-at "LOGBOOK" (point)))
|
(org-remove-empty-drawer-at "LOGBOOK" (point)))
|
||||||
(message "Clock gone, cancel the timer anyway")
|
(message "Clock gone, cancel the timer anyway")
|
||||||
|
|
|
@ -6703,6 +6703,8 @@ open and agenda-wise Org files."
|
||||||
(org-flag-drawer t))))))
|
(org-flag-drawer t))))))
|
||||||
|
|
||||||
(defun org-flag-drawer (flag)
|
(defun org-flag-drawer (flag)
|
||||||
|
"When FLAG is non-nil, hide the drawer we are within.
|
||||||
|
Otherwise make it visible."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(beginning-of-line 1)
|
(beginning-of-line 1)
|
||||||
(when (looking-at "^[ \t]*:[a-zA-Z][a-zA-Z0-9]*:")
|
(when (looking-at "^[ \t]*:[a-zA-Z][a-zA-Z0-9]*:")
|
||||||
|
@ -17800,10 +17802,10 @@ BEG and END default to the buffer boundaries."
|
||||||
|
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays)
|
(org-defkey org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays)
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-i" 'org-clock-in)
|
(org-defkey org-mode-map "\C-c\C-x\C-i" 'org-clock-in)
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-I" 'org-clock-in-last)
|
(org-defkey org-mode-map "\C-c\C-x\C-x" 'org-clock-in-last)
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-o" 'org-clock-out)
|
(org-defkey org-mode-map "\C-c\C-x\C-o" 'org-clock-out)
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-j" 'org-clock-goto)
|
(org-defkey org-mode-map "\C-c\C-x\C-j" 'org-clock-goto)
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel)
|
(org-defkey org-mode-map "\C-c\C-x\C-q" 'org-clock-cancel)
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-d" 'org-clock-display)
|
(org-defkey org-mode-map "\C-c\C-x\C-d" 'org-clock-display)
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report)
|
(org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report)
|
||||||
(org-defkey org-mode-map "\C-c\C-x\C-u" 'org-dblock-update)
|
(org-defkey org-mode-map "\C-c\C-x\C-u" 'org-dblock-update)
|
||||||
|
|
Loading…
Reference in New Issue