emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] [PATCH] Add the ability to remove time ranges specifications f


From: Julien Barnier
Subject: [Orgmode] [PATCH] Add the ability to remove time ranges specifications for agenda items that span on several days
Date: Mon, 12 Jul 2010 13:57:24 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Carsten Dominik <carsten.dominik <at> gmail.com> writes:

> No, there is currently not.

I just coded a small patch that seems to work. It introduces a new custom
variable to org-agenda, called "org-agenda-remove-timeranges-from-blocks" (there
could be a better name !) which, when non-nil, removes the time ranges
specifications from agenda lines.

Short example with the following entry :

*** <2010-07-16 lun.>--<2010-07-17 mer.> Test entry

If the variable is set to nil :

Vendredi   16 Juillet 2010
   -- <2010-07-16 lun.>--<2010-07-17 mer.> Test entry
Samedi     17 Juillet 2010
   -- <2010-07-16 lun.>--<2010-07-17 mer.> Test entry

If the variable is non-nil :

Vendredi   16 Juillet 2010
   --  Test entry
Samedi     17 Juillet 2010
   --  Test entry


Feel free to modify the patch or to find it quite unuseful :-)

Sincerely,

Julien

---
 lisp/org-agenda.el |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 191ee52..7a10375 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1336,6 +1336,11 @@ the headline/diary entry."
          (const :tag "Never" nil)
          (const :tag "When at beginning of entry" beg)))
 
+(defcustom org-agenda-remove-timeranges-from-blocks nil
+  "Non-nil means remove time ranges specifications in agenda
+items that span on several days."
+  :group 'org-agenda-line-format
+  :type 'boolean)
 
 (defcustom org-agenda-default-appointment-duration nil
   "Default duration for appointments that only have a starting time.
@@ -4790,13 +4795,20 @@ FRACTION is what fraction of the head-warning time has
passed."
                (setq tags (org-get-tags-at))
                (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
                (setq head (match-string 1))
+               (setq remove-re
+                     (if org-agenda-remove-timeranges-from-blocks
+                         (concat
+                          "<" (regexp-quote s1) ".*?>"
+                          "--"
+                          "<" (regexp-quote s2) ".*?>")
+                       nil))
                (setq txt (org-format-agenda-item
                           (format
                            (nth (if (= d1 d2) 0 1)
                                 org-agenda-timerange-leaders)
                            (1+ (- d0 d1)) (1+ (- d2 d1)))
                           head category tags
-                          timestr)))
+                          timestr nil remove-re)))
              (org-add-props txt props
                'org-marker marker 'org-hd-marker hdmarker
                'type "block" 'date date
-- 
1.7.1





reply via email to

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