|
@@ -34,7 +34,7 @@
|
|
|
(require 'org)
|
|
|
|
|
|
(defcustom org-effectiveness-max-todo 50
|
|
|
- "This variable is useful to advice to the user about
|
|
|
+ "This variable is useful to advice to the user about
|
|
|
many TODO pending"
|
|
|
:type 'integer
|
|
|
:group 'org-effectiveness)
|
|
@@ -60,10 +60,10 @@ many TODO pending"
|
|
|
(defun org-effectiveness-count-todo()
|
|
|
"Print a message with the number of todo tasks in the current buffer"
|
|
|
(interactive)
|
|
|
- (save-excursion
|
|
|
+ (save-excursion
|
|
|
(goto-char (point-min))
|
|
|
(message "Number of TODO: %d" (count-matches "* TODO"))))
|
|
|
-
|
|
|
+
|
|
|
(defun org-effectiveness-count-done()
|
|
|
"Print a message with the number of done tasks in the current buffer"
|
|
|
(interactive)
|
|
@@ -154,14 +154,14 @@ many TODO pending"
|
|
|
(defun org-effectiveness-plot(startdate enddate &optional save)
|
|
|
(interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)
|
|
|
(setq dates (org-effectiveness-check-dates startdate enddate))
|
|
|
- (setq syear (cadr (assoc 'startyear dates)))
|
|
|
- (setq smonth (cadr (assoc 'startmonth dates)))
|
|
|
- (setq eyear (cadr (assoc 'endyear dates)))
|
|
|
- (setq emonth (assoc 'endmonth dates))
|
|
|
+ (setq syear (cadr (assq 'startyear dates)))
|
|
|
+ (setq smonth (cadr (assq 'startmonth dates)))
|
|
|
+ (setq eyear (cadr (assq 'endyear dates)))
|
|
|
+ (setq emonth (assq 'endmonth dates))
|
|
|
;; Checking the format of the dates
|
|
|
- (if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" startdate))
|
|
|
+ (if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" startdate))
|
|
|
(message "The start date must have the next format YYYY-MM"))
|
|
|
- (if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" enddate))
|
|
|
+ (if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" enddate))
|
|
|
(message "The end date must have the next format YYYY-MM"))
|
|
|
;; Checking if startdate < enddate
|
|
|
(if (string-match "^[0-9][0-9][0-9][0-9]" startdate)
|
|
@@ -176,19 +176,19 @@ many TODO pending"
|
|
|
(message "The start date must be before that end date"))
|
|
|
(if (and (= startyear endyear) (> startmonth endmonth))
|
|
|
(message "The start date must be before that end date"))
|
|
|
-;; Create a file
|
|
|
+;; Create a file
|
|
|
(let ((month startmonth)
|
|
|
(year startyear)
|
|
|
(str ""))
|
|
|
- (while (or (> endyear year) (and (= endyear year) (>= endmonth month)))
|
|
|
+ (while (or (> endyear year) (and (= endyear year) (>= endmonth month)))
|
|
|
(setq str (concat str (number-to-string year) "-" (org-effectiveness-month-to-string month) " " (org-effectiveness-in-date (concat (number-to-string year) "-" (org-effectiveness-month-to-string month)) 1) "\n"))
|
|
|
(if (= month 12)
|
|
|
- (progn
|
|
|
+ (progn
|
|
|
(setq year (+ 1 year))
|
|
|
(setq month 1))
|
|
|
(setq month (+ 1 month))))
|
|
|
(write-region str nil "/tmp/org-effectiveness"))
|
|
|
-;; Create the bar graph
|
|
|
+;; Create the bar graph
|
|
|
(if (eq save t)
|
|
|
(setq strplot "/usr/bin/gnuplot -e 'set term png; set output \"/tmp/org-effectiveness.png\"; plot \"/tmp/org-effectiveness\" using 2:xticlabels(1) with histograms' -p")
|
|
|
(setq strplot "/usr/bin/gnuplot -e 'plot \"/tmp/org-effectiveness\" using 2:xticlabels(1) with histograms' -p"))
|
|
@@ -245,9 +245,9 @@ many TODO pending"
|
|
|
(defun org-effectiveness-check-dates (startdate enddate)
|
|
|
"Generate a list with ((startyear startmonth) (endyear endmonth))"
|
|
|
(setq str nil)
|
|
|
- (if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" startdate))
|
|
|
+ (if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" startdate))
|
|
|
(setq str "The start date must have the next format YYYY-MM"))
|
|
|
- (if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" enddate))
|
|
|
+ (if (not (string-match "[0-9][0-9][0-9][0-9]-[0-9][0-9]" enddate))
|
|
|
(setq str "The end date must have the next format YYYY-MM"))
|
|
|
;; Checking if startdate < enddate
|
|
|
(if (string-match "^[0-9][0-9][0-9][0-9]" startdate)
|
|
@@ -270,12 +270,12 @@ many TODO pending"
|
|
|
(defun org-effectiveness-plot-ascii (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)))
|
|
|
+ (let ((syear (cadr (assq 'startyear dates)))
|
|
|
+ (smonth (cadr (assq 'startmonth dates)))
|
|
|
+ (year (cadr (assq 'startyear dates)))
|
|
|
+ (month (cadr (assq 'startmonth dates)))
|
|
|
+ (emonth (cadr (assq 'endmonth dates)))
|
|
|
+ (eyear (cadr (assq 'endyear dates)))
|
|
|
(buffer (current-buffer))
|
|
|
(str ""))
|
|
|
(while (or (> eyear year) (and (= eyear year) (>= emonth month)))
|
|
@@ -284,7 +284,7 @@ many TODO pending"
|
|
|
(org-effectiveness-ascii-bar (string-to-number str) (format "%s-%s" year month))
|
|
|
(switch-to-buffer buffer)
|
|
|
(if (eq month 12)
|
|
|
- (progn
|
|
|
+ (progn
|
|
|
(setq year (+ 1 year))
|
|
|
(setq month 1))
|
|
|
(setq month (+ 1 month)))))
|
|
@@ -294,12 +294,12 @@ many TODO pending"
|
|
|
(defun org-effectiveness-plot-ascii-ntasks (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)))
|
|
|
+ (let ((syear (cadr (assq 'startyear dates)))
|
|
|
+ (smonth (cadr (assq 'startmonth dates)))
|
|
|
+ (year (cadr (assq 'startyear dates)))
|
|
|
+ (month (cadr (assq 'startmonth dates)))
|
|
|
+ (emonth (cadr (assq 'endmonth dates)))
|
|
|
+ (eyear (cadr (assq 'endyear dates)))
|
|
|
(buffer (current-buffer))
|
|
|
(str ""))
|
|
|
(while (or (> eyear year) (and (= eyear year) (>= emonth month)))
|
|
@@ -308,7 +308,7 @@ many TODO pending"
|
|
|
(org-effectiveness-ascii-bar (string-to-number str) (format "%s-%s" year month))
|
|
|
(switch-to-buffer buffer)
|
|
|
(if (eq month 12)
|
|
|
- (progn
|
|
|
+ (progn
|
|
|
(setq year (+ 1 year))
|
|
|
(setq month 1))
|
|
|
(setq month (+ 1 month)))))
|
|
@@ -317,12 +317,12 @@ many TODO pending"
|
|
|
(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)))
|
|
|
+ (let ((syear (cadr (assq 'startyear dates)))
|
|
|
+ (smonth (cadr (assq 'startmonth dates)))
|
|
|
+ (year (cadr (assq 'startyear dates)))
|
|
|
+ (month (cadr (assq 'startmonth dates)))
|
|
|
+ (emonth (cadr (assq 'endmonth dates)))
|
|
|
+ (eyear (cadr (assq 'endyear dates)))
|
|
|
(buffer (current-buffer))
|
|
|
(str ""))
|
|
|
(while (or (> eyear year) (and (= eyear year) (>= emonth month)))
|
|
@@ -331,7 +331,7 @@ many TODO pending"
|
|
|
(org-effectiveness-ascii-bar (string-to-number str) (format "%s-%s" year month))
|
|
|
(switch-to-buffer buffer)
|
|
|
(if (eq month 12)
|
|
|
- (progn
|
|
|
+ (progn
|
|
|
(setq year (+ 1 year))
|
|
|
(setq month 1))
|
|
|
(setq month (+ 1 month)))))
|
|
@@ -342,12 +342,12 @@ many TODO pending"
|
|
|
"Print html bars about the effectiveness in a buffer"
|
|
|
(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)))
|
|
|
+ (let ((syear (cadr (assq 'startyear dates)))
|
|
|
+ (smonth (cadr (assq 'startmonth dates)))
|
|
|
+ (year (cadr (assq 'startyear dates)))
|
|
|
+ (month (cadr (assq 'startmonth dates)))
|
|
|
+ (emonth (cadr (assq 'endmonth dates)))
|
|
|
+ (eyear (cadr (assq 'endyear dates)))
|
|
|
(buffer (current-buffer))
|
|
|
(str ""))
|
|
|
(switch-to-buffer "*org-effectiveness-html*")
|
|
@@ -359,7 +359,7 @@ many TODO pending"
|
|
|
(switch-to-buffer buffer)
|
|
|
(format "%s-%s" year month)
|
|
|
(if (eq month 12)
|
|
|
- (progn
|
|
|
+ (progn
|
|
|
(setq year (+ 1 year))
|
|
|
(setq month 1))
|
|
|
(setq month (+ 1 month))))
|
|
@@ -367,4 +367,3 @@ many TODO pending"
|
|
|
(insert "</body></html>")))
|
|
|
|
|
|
(provide 'org-effectiveness)
|
|
|
-
|