emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Update both indicators: [/] and [%]
@ 2008-12-20 19:25 Jari Aalto
  2008-12-20 20:35 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Jari Aalto @ 2008-12-20 19:25 UTC (permalink / raw)
  To: emacs-orgmode


The Following patch allows writing both indicators and to update them:

    * Inbox [%] [/]
    ** TODO ...
    ** TODO ...
    M-x org-update-parent-todo-statistics

2008-12-20  Jari Aalto  <jari.aalto@cante.net>

        * 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 [%].

Get it at:

    git remote add <name> http://git.cante.net/my/emacs-lisp-dev--org.git
    git fetch <name>
    git branch -a

    git checkout -b test master
    git diff <name/branch>
    git merge <name/branch>

Where changes are in <branch>
"org-update-parent-todo-statistics+both-indicators"

Jari

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Update both indicators: [/] and [%]
  2008-12-20 19:25 [PATCH] Update both indicators: [/] and [%] Jari Aalto
@ 2008-12-20 20:35 ` Carsten Dominik
  2008-12-21  0:50   ` Jari Aalto
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2008-12-20 20:35 UTC (permalink / raw)
  To: Jari Aalto; +Cc: emacs-orgmode

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?

Thanks.

- Carsten

On Dec 20, 2008, at 8:25 PM, Jari Aalto wrote:

>
> The Following patch allows writing both indicators and to update them:
>
>    * Inbox [%] [/]
>    ** TODO ...
>    ** TODO ...
>    M-x org-update-parent-todo-statistics
>
> 2008-12-20  Jari Aalto  <jari.aalto@cante.net>
>
>        * 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 [%].
>
> Get it at:
>
>    git remote add <name> http://git.cante.net/my/emacs-lisp-dev--org.git
>    git fetch <name>
>    git branch -a
>
>    git checkout -b test master
>    git diff <name/branch>
>    git merge <name/branch>
>
> Where changes are in <branch>
> "org-update-parent-todo-statistics+both-indicators"
>
> Jari
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Update both indicators: [/] and [%]
  2008-12-20 20:35 ` Carsten Dominik
@ 2008-12-21  0:50   ` Jari Aalto
  2008-12-21  5:55     ` Bernt Hansen
  0 siblings, 1 reply; 4+ messages in thread
From: Jari Aalto @ 2008-12-21  0:50 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> 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 <jari.aalto@cante.net>
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 <jari.aalto@cante.net>
---
 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  <jari.aalto@cante.net>
+
+	* 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  <carsten.dominik@gmail.com>
 
 	* 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Update both indicators: [/] and [%]
  2008-12-21  0:50   ` Jari Aalto
@ 2008-12-21  5:55     ` Bernt Hansen
  0 siblings, 0 replies; 4+ messages in thread
From: Bernt Hansen @ 2008-12-21  5:55 UTC (permalink / raw)
  To: Jari Aalto; +Cc: emacs-orgmode

That would be because you are using the http: protocol which is fairly
dumb.  You end up transferring everything even if you don't need it.

Setting up a repo that uses the git:// protocol is more efficient on
network bandwidth.

-Bernt

Jari Aalto <jari.aalto@cante.net> writes:

> Carsten Dominik <dominik@science.uva.nl> 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 <jari.aalto@cante.net>
> 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 <jari.aalto@cante.net>
> ---
>  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  <jari.aalto@cante.net>
> +
> +	* 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  <carsten.dominik@gmail.com>
>  
>  	* 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
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-21  5:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-20 19:25 [PATCH] Update both indicators: [/] and [%] Jari Aalto
2008-12-20 20:35 ` Carsten Dominik
2008-12-21  0:50   ` Jari Aalto
2008-12-21  5:55     ` Bernt Hansen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).