From eb9c5ae49ad084b1a747aaa41f12457e06d771c9 Mon Sep 17 00:00:00 2001 From: David Arroyo Menendez Date: Sat, 15 Mar 2014 09:11:54 +0100 Subject: [PATCH 1/4] add org-effectiveness-advice feature --- contrib/lisp/org-effectiveness.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/contrib/lisp/org-effectiveness.el b/contrib/lisp/org-effectiveness.el index a872cb201..4206a2709 100644 --- a/contrib/lisp/org-effectiveness.el +++ b/contrib/lisp/org-effectiveness.el @@ -33,6 +33,22 @@ (require 'org) +(defcustom org-effectiveness-max-todo 50 + "This variable is useful to advice to the user about +many TODO pending" + :type 'integer + :group 'org-effectiveness) + +(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!"))) + +;; Check advice starting an org file +(add-hook 'org-mode-hook 'org-effectiveness-advice) + (defun org-effectiveness-count-keyword(keyword) "Print a message with the number of keyword outline in the current buffer" (interactive "sKeyword: ") From 48dd94cc39a41c789bf23892dab27d38287d5d7e Mon Sep 17 00:00:00 2001 From: David Arroyo Menendez Date: Sat, 15 Mar 2014 10:15:34 +0100 Subject: [PATCH 2/4] org-effectiveness.el (org-effectiveness-plot-ascii): fixed the problem changing the year in org-effectivenss-plot-ascii * org-effectiveness.el (org-effectiveness-plot-ascii): fixed the problem changing the year in org-effectivenss-plot-ascii TINYCHANGE --- contrib/lisp/org-effectiveness.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/contrib/lisp/org-effectiveness.el b/contrib/lisp/org-effectiveness.el index 4206a2709..7cd0d1edf 100644 --- a/contrib/lisp/org-effectiveness.el +++ b/contrib/lisp/org-effectiveness.el @@ -224,21 +224,22 @@ 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)) - (setq syear (cadr (assoc 'startyear dates))) - (setq smonth (cadr (assoc 'startmonth dates))) - (setq eyear (cadr (assoc 'endyear dates))) - (setq emonth (cadr (assoc 'endmonth dates))) ;; (switch-to-buffer "*org-effectiveness*") - (let ((month smonth) - (year syear) + (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))) (str "")) - (while (and (>= eyear year) (>= emonth month)) + (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)) - (if (= month 12) + (if (eq month 12) (progn (setq year (+ 1 year)) (setq month 1)) - (setq month (+ 1 month)))))) + (setq month (+ 1 month)))) +)) (provide 'org-effectiveness) From 002b451285c946db8292b01e36599a9fe89ee5f6 Mon Sep 17 00:00:00 2001 From: David Arroyo Menendez Date: Sat, 15 Mar 2014 11:02:51 +0100 Subject: [PATCH 3/4] 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 --- contrib/lisp/org-effectiveness.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/contrib/lisp/org-effectiveness.el b/contrib/lisp/org-effectiveness.el index 7cd0d1edf..998171205 100644 --- a/contrib/lisp/org-effectiveness.el +++ b/contrib/lisp/org-effectiveness.el @@ -224,22 +224,26 @@ 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)) -;; (switch-to-buffer "*org-effectiveness*") (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))) - (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) (progn (setq year (+ 1 year)) (setq month 1)) - (setq month (+ 1 month)))) -)) + (setq month (+ 1 month))))) + (switch-to-buffer "*org-effectiveness*")) + (provide 'org-effectiveness) From ee8d56447925d22e836e463e7c75e5154ac09369 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 15 Mar 2014 16:04:38 +0100 Subject: [PATCH 4/4] Properly unescape optional part in file links * lisp/org.el (org-open-at-point): Unescape optional part in file links. This patch allows to handle properly links like: [[file:somefile.org::*headline%20with%20spaces]] Thanks to Thomas Holst for reporting it. --- lisp/org.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index cbcc7f947..b1022fdde 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10556,7 +10556,8 @@ is used internally by `org-open-link-from-string'." (cond ((not option) nil) ((org-string-match-p "\\`[0-9]+\\'" option) (list (string-to-number option))) - (t (list nil option)))))))) + (t (list nil + (org-link-unescape option))))))))) ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "help")