summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Arroyo Menéndez <davidam@es.gnu.org>2016-01-25 15:24:25 +0100
committerDavid Arroyo Menéndez <davidam@es.gnu.org>2016-01-25 15:24:25 +0100
commit26fb4fa54e2bcc6c9ff29c49f68640c49c3c305a (patch)
tree35caa4a9edfe2648ceae6bd44763dc57e695130d
parent0c3ea42a7c65c3f2debdf36a6c99ffde299b6e25 (diff)
downloadorg-mode-26fb4fa54e2bcc6c9ff29c49f68640c49c3c305a.tar.gz
org-effectiveness.el: Add org-effectiveness-plot-ascii-dones, fix org-effectiveness-advice and fix org-effectiveness-dones-in-date.
-rw-r--r--contrib/lisp/org-effectiveness.el39
1 files changed, 33 insertions, 6 deletions
diff --git a/contrib/lisp/org-effectiveness.el b/contrib/lisp/org-effectiveness.el
index 06e10b2..a653802 100644
--- a/contrib/lisp/org-effectiveness.el
+++ b/contrib/lisp/org-effectiveness.el
@@ -42,9 +42,10 @@ many TODO pending"
(defun org-effectiveness-advice()
"Advicing about a possible excess of TODOS"
(interactive)
- (goto-char (point-min))
- (if (< org-effectiveness-max-todo (count-matches "* TODO"))
- (message "An excess of TODOS!")))
+ (save-excursion
+ (goto-char (point-min))
+ (if (< org-effectiveness-max-todo (count-matches "* TODO"))
+ (message "An excess of TODOS!"))))
;; Check advice starting an org file
(add-hook 'org-mode-hook 'org-effectiveness-advice)
@@ -102,12 +103,14 @@ many TODO pending"
(setq count (count-matches (concat keyword ".*\n.*" date)))
(message (concat "%sS: %d" keyword count)))
-(defun org-effectiveness-dones-in-date(date)
+(defun org-effectiveness-dones-in-date(date &optional notmessage)
(interactive "sGive me a date: " date)
(save-excursion
(goto-char (point-min))
- (setq count (count-matches (concat "DONE.*\n.*" date)))
- (message "DONES: %d" count)))
+ (let ((count (count-matches (concat "DONE.*\n.*" date))))
+ (if (eq notmessage 1)
+ (message "%d" count)
+ (message "DONES: %d " count)))))
(defun org-effectiveness-todos-in-date(date)
(interactive "sGive me a date: " date)
@@ -311,6 +314,30 @@ many TODO pending"
(setq month (+ 1 month)))))
(switch-to-buffer "*org-effectiveness*"))
+(defun org-effectiveness-plot-ascii-dones (startdate enddate)
+ (interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)
+ (setq dates (org-effectiveness-check-dates startdate enddate))
+ (let ((syear (cadr (assoc 'startyear dates)))
+ (smonth (cadr (assoc 'startmonth dates)))
+ (year (cadr (assoc 'startyear dates)))
+ (month (cadr (assoc 'startmonth dates)))
+ (emonth (cadr (assoc 'endmonth dates)))
+ (eyear (cadr (assoc 'endyear dates)))
+ (buffer (current-buffer))
+ (str ""))
+ (while (or (> eyear year) (and (= eyear year) (>= emonth month)))
+ (setq str (org-effectiveness-dones-in-date (concat (number-to-string year) "-" (org-effectiveness-month-to-string month)) 1))
+ (switch-to-buffer "*org-effectiveness*")
+ (org-effectiveness-ascii-bar (string-to-number str) (format "%s-%s" year month))
+ (switch-to-buffer buffer)
+ (if (eq month 12)
+ (progn
+ (setq year (+ 1 year))
+ (setq month 1))
+ (setq month (+ 1 month)))))
+ (switch-to-buffer "*org-effectiveness*"))
+
+
(defun org-effectiveness-plot-html (startdate enddate)
"Print html bars about the effectiveness in a buffer"
(interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)