emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Julien Barnier <julien@nozav.org>
To: emacs-orgmode@gnu.org
Subject: [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)	[thread overview]
Message-ID: <loom.20100712T155021-318@post.gmane.org> (raw)
In-Reply-To: 1912379A-F701-4A61-BD37-D43A648EBD7B@gmail.com

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	other threads:[~2010-07-12 14:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12  8:17 Hide timestamps for several days time range in agenda Julien Barnier
2010-07-12  9:50 ` Rémi Vanicat
2010-07-12 10:12   ` Julien Barnier
2010-07-12 11:40     ` Carsten Dominik
2010-07-12 13:57       ` Julien Barnier [this message]

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=loom.20100712T155021-318@post.gmane.org \
    --to=julien@nozav.org \
    --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).