emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Mikhanosha <max@openchat.com>
To: Org Mode List <emacs-orgmode@gnu.org>
Subject: [PATCH 1/2] Fix error with %e agenda prefix format when there is no effort set
Date: Thu, 21 Jul 2011 13:56:53 -0400	[thread overview]
Message-ID: <87ipqv5xga.wl%max@openchat.com> (raw)

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

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 <max@openchat.com>
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)
       (setq rtn (concat (eval org-prefix-format-compiled) txt))
 
       ;; And finally add the text properties
-- 
1.7.3.4

             reply	other threads:[~2011-07-21 18:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-21 17:56 Max Mikhanosha [this message]
2011-07-22 13:36 ` [PATCH 1/2] Fix error with %e agenda prefix format when there is no effort set Bastien
2011-07-22 15:57   ` Max Mikhanosha
2011-07-27 13:00     ` Bastien
2011-07-22 18:01   ` [PATCH] Fix %e agenda format and refresh of agenda items in general Max Mikhanosha
2011-07-27 13:01     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ipqv5xga.wl%max@openchat.com \
    --to=max@openchat.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).