Browse Source

org-effectiveness.el (org-effectiveness-plot-ascii): now we open a new buffer with the ascii bars

    * org-effectiveness.el (org-effectiveness-plot-ascii): now we open a new buffer with the ascii bars

    TINYCHANGE
David Arroyo Menendez 12 years ago
parent
commit
002b451285
1 changed files with 9 additions and 5 deletions
  1. 9 5
      contrib/lisp/org-effectiveness.el

+ 9 - 5
contrib/lisp/org-effectiveness.el

@@ -224,22 +224,26 @@ many TODO pending"
 (defun org-effectiveness-plot-ascii (startdate enddate)
 (defun org-effectiveness-plot-ascii (startdate enddate)
   (interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)
   (interactive "sGive me the start date: \nsGive me the end date: " startdate enddate)
   (setq dates (org-effectiveness-check-dates startdate enddate))
   (setq dates (org-effectiveness-check-dates startdate enddate))
-;;  (switch-to-buffer "*org-effectiveness*")
   (let ((syear (cadr (assoc 'startyear dates)))
   (let ((syear (cadr (assoc 'startyear dates)))
 	(smonth (cadr (assoc 'startmonth dates)))
 	(smonth (cadr (assoc 'startmonth dates)))
   	(year (cadr (assoc 'startyear dates)))
   	(year (cadr (assoc 'startyear dates)))
 	(month (cadr (assoc 'startmonth dates)))
 	(month (cadr (assoc 'startmonth dates)))
 	(emonth (cadr (assoc 'endmonth dates)))
 	(emonth (cadr (assoc 'endmonth dates)))
 	(eyear (cadr (assoc 'endyear dates)))
 	(eyear (cadr (assoc 'endyear dates)))
+	(buffer (current-buffer))
   	(str ""))
   	(str ""))
-    (while (or (>= eyear year) (and (= eyear year) (>= emonth month)))
-      (org-effectiveness-ascii-bar (string-to-number (org-effectiveness-in-date (concat (number-to-string year) "-" (org-effectiveness-month-to-string month)) 1)) (format "%s-%s" year month))
+    (while (or (> eyear year) (and (= eyear year) (>= emonth month)))
+      (setq str (org-effectiveness-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)
       (if (eq month 12)
   	  (progn 
   	  (progn 
   	    (setq year (+ 1 year))
   	    (setq year (+ 1 year))
   	    (setq month 1))
   	    (setq month 1))
-  	(setq month (+ 1 month))))
-))
+  	(setq month (+ 1 month)))))
+  (switch-to-buffer "*org-effectiveness*"))
+
 
 
 (provide 'org-effectiveness)
 (provide 'org-effectiveness)