From 0c3ea42a7c65c3f2debdf36a6c99ffde299b6e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Arroyo=20Men=C3=A9ndez?= Date: Mon, 25 Jan 2016 12:07:16 +0100 Subject: [PATCH] org-effectiveness.el: Add save-excursion to org-effectiveness-dones-in-date, org-effectiveness-canceled-in-date, org-effectiveness-todos-in-date * contrib/lisp/org-effectiveness.el (org-effectiveness-dones-in-date, org-effectiveness-canceled-in-date, org-effectiveness-todos-in-date): Add save-excursion --- contrib/lisp/org-effectiveness.el | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/contrib/lisp/org-effectiveness.el b/contrib/lisp/org-effectiveness.el index 4dd4d94ca..06e10b203 100644 --- a/contrib/lisp/org-effectiveness.el +++ b/contrib/lisp/org-effectiveness.el @@ -96,25 +96,32 @@ many TODO pending" (setq effectiveness (* 100 (/ done (+ done canc))))) (message "Effectiveness: %f" effectiveness)))) + (defun org-effectiveness-keywords-in-date(keyword date) (interactive "sKeyword: \nsDate: " keyword date) (setq count (count-matches (concat keyword ".*\n.*" date))) (message (concat "%sS: %d" keyword count))) (defun org-effectiveness-dones-in-date(date) - (interactive "sGive me a date: " date) - (setq count (count-matches (concat "DONE.*\n.*" date))) - (message "DONES: %d" count)) + (interactive "sGive me a date: " date) + (save-excursion + (goto-char (point-min)) + (setq count (count-matches (concat "DONE.*\n.*" date))) + (message "DONES: %d" count))) -(defun org-effectivenes-todos-in-date(date) - (interactive "sGive me a date: " date) - (setq count (count-matches (concat "TODO.*\n.*" date))) - (message "TODOS: %d" count)) +(defun org-effectiveness-todos-in-date(date) + (interactive "sGive me a date: " date) + (save-excursion + (goto-char (point-min)) + (setq count (count-matches (concat "TODO.*\n.*" date))) + (message "TODOS: %d" count))) (defun org-effectiveness-canceled-in-date(date) - (interactive "sGive me a date: " date) - (setq count (count-matches (concat "CANCEL+ED.*\n.*" date))) - (message "CANCELEDS: %d" count)) + (interactive "sGive me a date: " date) + (save-excursion + (goto-char (point-min)) + (setq count (count-matches (concat "CANCEL+ED.*\n.*" date))) + (message "CANCELEDS: %d" count))) (defun org-effectiveness-ntasks-in-date(date &optional notmessage) (interactive "sGive me a date: " date)