emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [PATCH 1/2] Fix error with %e agenda prefix format when there is


From: Bastien
Subject: Re: [O] [PATCH 1/2] Fix error with %e agenda prefix format when there is no effort set
Date: Fri, 22 Jul 2011 15:36:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi Max,

thanks for the patch.

Max Mikhanosha <address@hidden> writes:

> `org-agenda-prefix-format' has un undocumented format %e for Effort, which
> is broken. it throws error on entries without effort property.

Yep, right.

> Following patch fixes that problem. TODO: make agenda redraw current line
> when `org-agenda-set-effort' sets a new effort
>
> From c06b376737142eff5cdec71e8fc8129552aba673 Mon Sep 17 00:00:00 2001
> From: Max Mikhanosha <address@hidden>
> Date: Wed, 6 Jul 2011 20:05:06 -0400
> Subject: [PATCH 1/2] Fix error with %e agenda prefix format when there is no 
> effort set
>
> ---
>  lisp/org-agenda.el |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index cd09a74..f34ffae 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -5511,7 +5511,9 @@ Any match of REMOVE-RE will be removed from TXT."
>               (error nil)))
>       (when effort
>         (setq neffort (org-duration-string-to-minutes effort)
> -             effort (setq effort (concat "[" effort "]" )))))
> +             effort (setq effort (concat "[" effort "]")))))
> +      ;; prevent erroring out with %e format when there is no effort
> +      (or effort (setq effort ""))
>  
>        (when remove-re
>       (while (string-match remove-re txt)
> @@ -5549,6 +5551,7 @@ Any match of REMOVE-RE will be removed from TXT."
>                (>= (length category) org-prefix-category-max-length))
>           (setq category (substring category 0 (1- 
> org-prefix-category-max-length)))))
>        ;; Evaluate the compiled format
> +      (assert effort)

Why is this needed?  

>        (setq rtn (concat (eval org-prefix-format-compiled) txt))
>  
>        ;; And finally add the text properties

Thanks,

-- 
 Bastien



reply via email to

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