emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [ feature request ] colourful timestamps
@ 2007-12-03 14:17 Phil Jackson
  2007-12-09 22:39 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Jackson @ 2007-12-03 14:17 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

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)))

Cheers,
Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ feature request ] colourful timestamps
  2007-12-03 14:17 [ feature request ] colourful timestamps Phil Jackson
@ 2007-12-09 22:39 ` Bastien
  2007-12-10 22:27   ` Phil Jackson
  2007-12-17  9:12   ` Carsten Dominik
  0 siblings, 2 replies; 4+ messages in thread
From: Bastien @ 2007-12-09 22:39 UTC (permalink / raw)
  To: Phil Jackson; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

Hi Phil,

Phil Jackson <phil@shellarchive.co.uk> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.el.patch --]
[-- Type: text/x-diff, Size: 1669 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
Bastien

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ feature request ] colourful timestamps
  2007-12-09 22:39 ` Bastien
@ 2007-12-10 22:27   ` Phil Jackson
  2007-12-17  9:12   ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: Phil Jackson @ 2007-12-10 22:27 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien,

Bastien <bzg@altern.org> writes:

> Phil Jackson <phil@shellarchive.co.uk> writes:
>
>> Something I thought might be nice is highlighting of timestamps
>> according to there relativity to time().

[...]

> 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?

I can't see why it would change, I would expect the map to remain
largely static. Only the colours of the links would change. The idea is
that one would become used to scanning the colours and be able to 'sort'
tasks visually. Am I making any sense?

> 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):

That's brilliant, thanks for the effort. I'm putting this into my config
straight away. Is there a chance of your patch making trunk?

Cheers,
Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ feature request ] colourful timestamps
  2007-12-09 22:39 ` Bastien
  2007-12-10 22:27   ` Phil Jackson
@ 2007-12-17  9:12   ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2007-12-17  9:12 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

I am taking this patch, thanks.

- Carsten

On Dec 9, 2007 11:39 PM, Bastien <bzg@altern.org> wrote:
> Hi Phil,
>
> Phil Jackson <phil@shellarchive.co.uk> 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.
>
>
> --
> Bastien
>
> _______________________________________________
> 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
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-17  9:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-03 14:17 [ feature request ] colourful timestamps Phil Jackson
2007-12-09 22:39 ` Bastien
2007-12-10 22:27   ` Phil Jackson
2007-12-17  9:12   ` Carsten Dominik

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).