summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-02-19 12:59:46 +0100
committerBastien Guerry <bzg@altern.org>2013-02-19 12:59:46 +0100
commit85a1395efadfd70e7eb90190985bd404b3bb35dc (patch)
tree6ffbc3fa4ea85a325ab91d6f878ba84e2ad406ba
parentd1e57bd884f5285e40e0bbae60483aac93657cab (diff)
downloadorg-mode-85a1395efadfd70e7eb90190985bd404b3bb35dc.tar.gz
org-clock.el: Minor code clean-up
* org-clock.el (org-clock-set-current) (org-clock-delete-current): Delete. (org-clock-in, org-clock-out): Set and delete `org-clock-current-task'. Minor code clean-up.
-rw-r--r--lisp/org-clock.el26
1 files changed, 6 insertions, 20 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 2c56147..3ac345b 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1093,16 +1093,7 @@ so long."
60.0))))
org-clock-user-idle-start)))))
-(defvar org-clock-current-task nil
- "Task currently clocked in.")
-(defun org-clock-set-current ()
- "Set `org-clock-current-task' to the task currently clocked in."
- (setq org-clock-current-task (nth 4 (org-heading-components))))
-
-(defun org-clock-delete-current ()
- "Reset `org-clock-current-task' to nil."
- (setq org-clock-current-task nil))
-
+(defvar org-clock-current-task nil "Task currently clocked in.")
(defvar org-clock-out-time nil) ; store the time of the last clock-out
;;;###autoload
@@ -1200,7 +1191,7 @@ make this the default behavior.)"
;; manually
(run-hooks 'org-clock-in-prepare-hook)
(org-clock-history-push))
- (org-clock-set-current)
+ (setq org-clock-current-task (nth 4 (org-heading-components)))
(cond ((functionp org-clock-in-switch-to-state)
(looking-at org-complex-heading-regexp)
(let ((newstate (funcall org-clock-in-switch-to-state
@@ -1220,14 +1211,11 @@ make this the default behavior.)"
(cond ((and org-clock-heading-function
(functionp org-clock-heading-function))
(funcall org-clock-heading-function))
- ((and (looking-at org-complex-heading-regexp)
- (match-string 4))
+ ((nth 4 (org-heading-components))
(replace-regexp-in-string
"\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1"
- (match-string 4)))
+ (match-string-no-properties 4)))
(t "???")))
- (setq org-clock-heading (org-propertize org-clock-heading
- 'face nil))
(org-clock-find-position org-clock-in-resume)
(cond
((and org-clock-in-resume
@@ -1566,7 +1554,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
te (if remove " => LINE REMOVED" ""))
(run-hooks 'org-clock-out-hook)
(unless (org-clocking-p)
- (org-clock-delete-current)))))))
+ (setq org-clock-current-task nil)))))))
(add-hook 'org-clock-out-hook 'org-clock-remove-empty-clock-drawer)
@@ -2799,9 +2787,7 @@ The details of what will be saved are regulated by the variable
(buffer-file-name b)
(or (not org-clock-persist-query-save)
(y-or-n-p (concat "Save current clock ("
- (substring-no-properties
- org-clock-heading)
- ") "))))
+ org-clock-heading ") "))))
(insert "(setq resume-clock '(\""
(buffer-file-name (org-clocking-buffer))
"\" . " (int-to-string (marker-position org-clock-marker))