emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: [PATCH] Update both indicators: [/] and [%]


From: Jari Aalto
Subject: [Orgmode] Re: [PATCH] Update both indicators: [/] and [%]
Date: Sun, 21 Dec 2008 02:50:30 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Carsten Dominik <address@hidden> writes:

> Hi Jari,
>
> if I try to fetch from your repo, git download in excess o 10MB, so
> something must be wrong here.  Can you please post a patch?
>

Hm, the repo is copy of yours. I'll see it later.

Jari

>From 9f64abd92bad42d7b8e0f5e6cfe61e88e18c907c Mon Sep 17 00:00:00 2001
From: Jari Aalto <address@hidden>
Date: Sun, 21 Dec 2008 02:49:40 +0200
Subject: [PATCH] org.el: (org-update-parent-todo-statistics): update both 
indicators

Signed-off-by: Jari Aalto <address@hidden>
---
 lisp/ChangeLog |    8 ++++++++
 lisp/org.el    |   17 ++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bec5200..c38c4e5 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2008-12-20  Jari Aalto  <address@hidden>
+
+       * org.el (org-update-parent-todo-statistics-1): New function.
+       Accept argument RE to update paricular statistics.
+       (org-update-parent-todo-statistics): Move functionality
+       to `org-update-parent-todo-statistics-1'. Update both
+       indicators: [/] and [%].
+
 2008-12-20  Carsten Dominik  <address@hidden>
 
        * org.el (org-get-refile-targets, org-refile-get-location): Use
diff --git a/lisp/org.el b/lisp/org.el
index 2e2f953..d4b3c40 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8304,10 +8304,9 @@ For calling through lisp, arg is also interpreted in the 
following way:
          (save-excursion
            (run-hook-with-args 'org-trigger-hook change-plist)))))))
 
-(defun org-update-parent-todo-statistics ()
-  "Update any statistics cookie in the parent of the current headline."
-  (interactive)
-  (let ((box-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
+(defun org-update-parent-todo-statistics-1 (re)
+  "Update statistics cookie matching RE in the parent of the current headline."
+  (let ((box-re re)
        level (cnt-all 0) (cnt-done 0) is-percent kwd)
     (catch 'exit
       (save-excursion
@@ -8315,7 +8314,8 @@ For calling through lisp, arg is also interpreted in the 
following way:
        (unless (and level
                     (re-search-forward box-re (point-at-eol) t))
          (throw 'exit nil))
-       (setq is-percent (match-end 2))
+       (if (save-match-data (string-match "%" (match-string 0)))
+           (setq is-percent t))
        (save-match-data
          (unless (outline-next-heading) (throw 'exit nil))
          (while (looking-at org-todo-line-regexp)
@@ -8333,6 +8333,13 @@ For calling through lisp, arg is also interpreted in the 
following way:
        (run-hook-with-args 'org-after-todo-statistics-hook
                            cnt-done (- cnt-all cnt-done))))))
 
+(defun org-update-parent-todo-statistics ()
+  "Update any statistics cookie in the parent of the current headline."
+  (interactive)
+  (dolist (re '("\\(\\[[0-9]*%\\]\\)"
+               "\\(\\[[0-9]*/[0-9]*\\]\\)"))
+    (org-update-parent-todo-statistics-1 re)))
+
 (defvar org-after-todo-statistics-hook nil
   "Hook that is called after a TODO statistics cookie has been updated.
 Each function is called with two arguments: the number of not-done entries
-- 
1.6.0.2






reply via email to

[Prev in Thread] Current Thread [Next in Thread]