From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: [ feature request ] colourful timestamps Date: Sun, 09 Dec 2007 22:39:48 +0000 Message-ID: <87ejdvh4qz.fsf@bzg.ath.cx> References: <87bq9750d6.fsf@shellarchive.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J1TsS-0006wT-AX for emacs-orgmode@gnu.org; Sun, 09 Dec 2007 16:39:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J1TsR-0006vA-KW for emacs-orgmode@gnu.org; Sun, 09 Dec 2007 16:39:55 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J1TsR-0006uw-Ff for emacs-orgmode@gnu.org; Sun, 09 Dec 2007 16:39:55 -0500 Received: from nf-out-0910.google.com ([64.233.182.189]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J1TsR-0007KT-25 for emacs-orgmode@gnu.org; Sun, 09 Dec 2007 16:39:55 -0500 Received: by nf-out-0910.google.com with SMTP id f5so961008nfh for ; Sun, 09 Dec 2007 13:39:54 -0800 (PST) In-Reply-To: <87bq9750d6.fsf@shellarchive.co.uk> (Phil Jackson's message of "Mon, 03 Dec 2007 14:17:09 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Phil Jackson Cc: emacs-orgmode@gnu.org --=-=-= Hi Phil, Phil Jackson writes: > Something I thought might be nice is highlighting of timestamps > according to there relativity to time(). > > For example, at time of writing, <2006-12-11> would be red, <2007-12-03 > Mon 19:00> pink. Perhaps for customisation: > > (setq org-timestamp-colour-map > '(("<2h" . 'face) > ("<10m" . 'face))) I like the general idea of having feedback about the proximity of a deadline or time-stamp. But I think doing this interactively is better, since the values like "<2h" "<10m" (in your example) are very likely to change quite often, no? In the same spirit, I've written this, which let you check for deadlines or scheduled items before a date (strings like "+2d" are okay): --8<---------------cut here---------------start------------->8--- (defun org-check-before-date (date) "Check if there are deadlines or scheduled entries before DATE." (interactive (list (org-read-date))) (let ((case-fold-search nil) (regexp (concat "\\<\\(" org-deadline-string "\\|" org-scheduled-string "\\) *<\\([^>]+\\)>")) (callback (lambda () (time-less-p (org-time-string-to-time (match-string 2)) (org-time-string-to-time date))))) (message "%d entries before %s" (org-occur regexp nil callback) date))) --8<---------------cut here---------------end--------------->8--- If you want to permanently add this to `org-sparse-trees', here is a patch against 5.16b. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org.el.patch diff -u /home/guerry/elisp/testing/org-5.16b/ /home/guerry/elisp/testing/tmp/org.el --- /home/guerry/elisp/testing/org-5.16b/org.el 2007-12-04 08:40:13.000000000 +0000 +++ /home/guerry/elisp/testing/tmp/org.el 2007-12-09 22:32:07.000000000 +0000 @@ -14433,11 +14433,13 @@ r Show entries matching a regular expression" (interactive "P") (let (ans kwd value) - (message "Sparse tree: [/]regexp [t]odo-kwd [T]ag [p]roperty [d]eadlines") + (message "Sparse tree: [/]regexp [t]odo-kwd [T]ag [p]roperty [d]eadlines [b]efore-date") (setq ans (read-char-exclusive)) (cond ((equal ans ?d) (call-interactively 'org-check-deadlines)) + ((equal ans ?b) + (call-interactively 'org-check-before-date)) ((equal ans ?t) (org-show-todo-tree '(4))) ((equal ans ?T) @@ -17372,6 +17374,20 @@ (org-occur regexp nil callback) org-warn-days))) +(defun org-check-before-date (date) + "Check if there are deadlines or scheduled entries before DATE." + (interactive (list (org-read-date))) + (let ((case-fold-search nil) + (regexp (concat "\\<\\(" org-deadline-string + "\\|" org-scheduled-string + "\\) *<\\([^>]+\\)>")) + (callback + (lambda () (time-less-p + (org-time-string-to-time (match-string 2)) + (org-time-string-to-time date))))) + (message "%d entries before %s" + (org-occur regexp nil callback) date))) + (defun org-evaluate-time-range (&optional to-buffer) "Evaluate a time range by computing the difference between start and end. Normally the result is just printed in the echo area, but with prefix arg Diff finished. Sun Dec 9 22:32:19 2007 --=-=-= -- Bastien --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--