summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-04-13 10:21:16 +0200
committerBastien Guerry <bzg@altern.org>2013-04-13 10:21:16 +0200
commit13deb41a3a2b2e7f52a89fda0e29d284903f02a3 (patch)
tree22de7956b063b42969c87b57d12404459e186a5d
parent9c141cfd8c0f0ca429730ddd395623cded47daab (diff)
downloadorg-mode-13deb41a3a2b2e7f52a89fda0e29d284903f02a3.tar.gz
org-clock.el (org-clock-select-task): Remove successive duplicates in the clock history to consider
* org-clock.el (org-clock-select-task): Remove successive duplicates in the clock history to consider. Thanks to Sébastien Vauban for pointing at this.
-rw-r--r--lisp/org-clock.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 62ddc5e..d96e034 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -516,7 +516,11 @@ of a different task.")
(defun org-clock-select-task (&optional prompt)
"Select a task that was recently associated with clocking."
(interactive)
- (let ((chl (length org-clock-history)) sel-list rpl (i 0) s)
+ (let (och chl sel-list rpl (i 0) s)
+ ;; Remove successive dups from the clock history to consider
+ (mapc (lambda (c) (if (not (equal c (car och))) (push c och)))
+ org-clock-history)
+ (setq och (reverse och) chl (length och))
(if (zerop chl)
(user-error "No recent clock")
(save-window-excursion
@@ -546,7 +550,7 @@ of a different task.")
(+ i (- ?A 10))) m))
(if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s))))
(push s sel-list)))
- org-clock-history)
+ och)
(run-hooks 'org-clock-before-select-task-hook)
(goto-char (point-min))
;; Set min-height relatively to circumvent a possible but in