emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Allow inactive timestamps in org-expiry (copy of lost patch)
@ 2011-03-28 18:21 Marcel van der Boom
  2011-03-28 18:55 ` Nick Dokos
  2011-05-24 13:18 ` [Accepted] " Carsten Dominik
  0 siblings, 2 replies; 5+ messages in thread
From: Marcel van der Boom @ 2011-03-28 18:21 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

Attached is a patch to org-expiry.el in contrib/lisp to allow a
customization of the timestamps inserted by org-expiry for 'CREATED'
and 'EXPIRED' properties.

This patch is what is attached to the message displayed at [1]. I have
been using this patch for a while and it works fine. From searching it
looks like this patch was 'forgotten', but I may have overlooked
something.

If the patch was rejected, you can ignore me. If it was forgotten I'd
like to request to include it.

Thx,
marcel

[1] http://www.mail-archive.com/emacs-orgmode@gnu.org/msg20882.html 


-- 
Marcel van der Boom  -- http://hsdev.com/mvdb.vcf
HS-Development BV    -- http://www.hsdev.com
So! web applications -- http://make-it-so.info
Cobra build          -- http://cobra.mrblog.nl

[-- Attachment #2: org-expiry.el.diff --]
[-- Type: text/x-patch, Size: 2961 bytes --]

diff --git a/contrib/lisp/org-expiry.el b/contrib/lisp/org-expiry.el
index 4a49399..930b921 100644
--- a/contrib/lisp/org-expiry.el
+++ b/contrib/lisp/org-expiry.el
@@ -81,6 +81,11 @@
   :tag "Org Expiry"
   :group 'org)
 
+(defcustom org-expiry-inactive-timestamps nil
+  "Insert inactive timestamps for the created and expired time properties"
+  :type 'boolean
+  :group 'org-expiry)
+
 (defcustom org-expiry-created-property-name "CREATED"
   "The name of the property for setting the creation date."
   :type 'string
@@ -283,21 +288,25 @@ to today's date.  With two `C-u' prefixes, prompt the user for to
 update the date."
   (interactive "P")
   (let* ((d (org-entry-get (point) org-expiry-created-property-name))
-	 d-time d-hour)
+	 d-time d-hour timestr)
     (when (or (null d) arg)
       ;; update if no date or non-nil prefix argument
       ;; FIXME Use `org-time-string-to-time' 
-      (setq d-time (if d (apply 'encode-time (org-parse-time-string d))
+      (setq d-time (if d (org-time-string-to-time d)
 		     (current-time)))
       (setq d-hour (format-time-string "%H:%M" d-time))
+      (setq timestr
+	    ;; two C-u prefixes will call org-read-date
+	    (if (equal arg '(16))
+		(concat "<" (org-read-date
+			     nil nil nil nil d-time d-hour) ">")
+	      (format-time-string (cdr org-time-stamp-formats))))
+      ;; maybe transform to inactive timestamp
+      (if org-expiry-inactive-timestamps
+	  (setq timestr (concat "[" (substring timestr 1 -1) "]")))
       (save-excursion
 	(org-entry-put
-	 (point) org-expiry-created-property-name
-	 ;; two C-u prefixes will call org-read-date
-	 (if (equal arg '(16))
-	     (concat "<" (org-read-date
-			  nil nil nil nil d-time d-hour) ">")
-	   (format-time-string (cdr org-time-stamp-formats))))))))
+	 (point) org-expiry-created-property-name timestr)))))
 
 (defun org-expiry-insert-expiry (&optional today)
   "Insert a property with the expiry date.
@@ -306,15 +315,20 @@ and insert today's date."
   (interactive "P")
   (let* ((d (org-entry-get (point) org-expiry-expiry-property-name))
 	 d-time d-hour)
-    (setq d-time (if d (apply 'encode-time (org-parse-time-string d))
+    (setq d-time (if d (org-time-string-to-time d)
 		   (current-time)))
     (setq d-hour (format-time-string "%H:%M" d-time))
+    (setq timestr (if today
+		      (format-time-string (cdr org-time-stamp-formats))
+		    (concat "<" (org-read-date
+				 nil nil nil nil d-time d-hour) ">")))
+    ;; maybe transform to inactive timestamp
+    (if org-expiry-inactive-timestamps
+	(setq timestr (concat "[" (substring timestr 1 -1) "]")))
+     
     (save-excursion
       (org-entry-put
-       (point) org-expiry-expiry-property-name
-       (if today (format-time-string (cdr org-time-stamp-formats))
-	 (concat "<" (org-read-date
-		      nil nil nil nil d-time d-hour) ">"))))))
+       (point) org-expiry-expiry-property-name timestr))))
 
 ;;; Functions to process expired entries:
 

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

* Re: [PATCH] Allow inactive timestamps in org-expiry (copy of lost patch)
  2011-03-28 18:21 [PATCH] Allow inactive timestamps in org-expiry (copy of lost patch) Marcel van der Boom
@ 2011-03-28 18:55 ` Nick Dokos
  2011-03-28 20:21   ` Marcel van der Boom
  2011-05-24 19:07   ` David Maus
  2011-05-24 13:18 ` [Accepted] " Carsten Dominik
  1 sibling, 2 replies; 5+ messages in thread
From: Nick Dokos @ 2011-03-28 18:55 UTC (permalink / raw)
  To: Marcel van der Boom; +Cc: nicholas.dokos, emacs-orgmode

Marcel van der Boom <marcel@hsdev.com> wrote:

> This patch is what is attached to the message displayed at [1]. I have
> been using this patch for a while and it works fine. From searching it
> looks like this patch was 'forgotten', but I may have overlooked
> something.
> 
> If the patch was rejected, you can ignore me. If it was forgotten I'd
> like to request to include it.
> 

I don't think it was rejected outright, it looks as if it was
inadvertently dropped. Probably part of the reason is that David sent
the patches as application/octet-stream so they never made it to
patchwork (was patchwork even running back in 2009? I don't remember
when it was set up.) The other part might be that it's a contrib package
so most people never get to use it, let alone complain about it. The third
part might be that it was Dec. 31, so people were out partying instead of
applying patches (unimaginable, I know :-) )

The patch is now in patchwork (under your name), so it will be addressed
at some point. One question: there was a second patch in the link you
provided - should that be resubmitted as well?

Nick

> 
> [1] http://www.mail-archive.com/emacs-orgmode@gnu.org/msg20882.html 
> 
> 

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

* Re: [PATCH] Allow inactive timestamps in org-expiry (copy of lost patch)
  2011-03-28 18:55 ` Nick Dokos
@ 2011-03-28 20:21   ` Marcel van der Boom
  2011-05-24 19:07   ` David Maus
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel van der Boom @ 2011-03-28 20:21 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode


On ma 28-mrt-2011 14:55
Nick Dokos <nicholas.dokos@hp.com> wrote:

> The patch is now in patchwork (under your name), so it will be
> addressed at some point. One question: there was a second patch in
> the link you provided - should that be resubmitted as well?

The patch I attached combined the two mentioned in the message into one
patch.

marcel
-- 
Marcel van der Boom  -- http://hsdev.com/mvdb.vcf
HS-Development BV    -- http://www.hsdev.com
So! web applications -- http://make-it-so.info
Cobra build          -- http://cobra.mrblog.nl

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

* [Accepted] Allow inactive timestamps in org-expiry (copy of lost patch)
  2011-03-28 18:21 [PATCH] Allow inactive timestamps in org-expiry (copy of lost patch) Marcel van der Boom
  2011-03-28 18:55 ` Nick Dokos
@ 2011-05-24 13:18 ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2011-05-24 13:18 UTC (permalink / raw)
  To: emacs-orgmode

Patch 722 (http://patchwork.newartisans.com/patch/722/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C20110328202149.67a32bdc%40hsdev.com%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] Allow inactive timestamps in org-expiry (copy of lost patch)
> Date: Mon, 28 Mar 2011 22:21:49 -0000
> From: Marcel van der Boom <marcel@hsdev.com>
> X-Patchwork-Id: 722
> Message-Id: <20110328202149.67a32bdc@hsdev.com>
> To: emacs-orgmode@gnu.org
> 
> Hi,
> 
> Attached is a patch to org-expiry.el in contrib/lisp to allow a
> customization of the timestamps inserted by org-expiry for 'CREATED'
> and 'EXPIRED' properties.
> 
> This patch is what is attached to the message displayed at [1]. I have
> been using this patch for a while and it works fine. From searching it
> looks like this patch was 'forgotten', but I may have overlooked
> something.
> 
> If the patch was rejected, you can ignore me. If it was forgotten I'd
> like to request to include it.
> 
> Thx,
> marcel
> 
> [1] http://www.mail-archive.com/emacs-orgmode@gnu.org/msg20882.html
> 
> 
> diff --git a/contrib/lisp/org-expiry.el b/contrib/lisp/org-expiry.el
> index 4a49399..930b921 100644
> --- a/contrib/lisp/org-expiry.el
> +++ b/contrib/lisp/org-expiry.el
> @@ -81,6 +81,11 @@
>    :tag "Org Expiry"
>    :group 'org)
>  
> +(defcustom org-expiry-inactive-timestamps nil
> +  "Insert inactive timestamps for the created and expired time properties"
> +  :type 'boolean
> +  :group 'org-expiry)
> +
>  (defcustom org-expiry-created-property-name "CREATED"
>    "The name of the property for setting the creation date."
>    :type 'string
> @@ -283,21 +288,25 @@ to today's date.  With two `C-u' prefixes, prompt the user for to
>  update the date."
>    (interactive "P")
>    (let* ((d (org-entry-get (point) org-expiry-created-property-name))
> -	 d-time d-hour)
> +	 d-time d-hour timestr)
>      (when (or (null d) arg)
>        ;; update if no date or non-nil prefix argument
>        ;; FIXME Use `org-time-string-to-time' 
> -      (setq d-time (if d (apply 'encode-time (org-parse-time-string d))
> +      (setq d-time (if d (org-time-string-to-time d)
>  		     (current-time)))
>        (setq d-hour (format-time-string "%H:%M" d-time))
> +      (setq timestr
> +	    ;; two C-u prefixes will call org-read-date
> +	    (if (equal arg '(16))
> +		(concat "<" (org-read-date
> +			     nil nil nil nil d-time d-hour) ">")
> +	      (format-time-string (cdr org-time-stamp-formats))))
> +      ;; maybe transform to inactive timestamp
> +      (if org-expiry-inactive-timestamps
> +	  (setq timestr (concat "[" (substring timestr 1 -1) "]")))
>        (save-excursion
>  	(org-entry-put
> -	 (point) org-expiry-created-property-name
> -	 ;; two C-u prefixes will call org-read-date
> -	 (if (equal arg '(16))
> -	     (concat "<" (org-read-date
> -			  nil nil nil nil d-time d-hour) ">")
> -	   (format-time-string (cdr org-time-stamp-formats))))))))
> +	 (point) org-expiry-created-property-name timestr)))))
>  
>  (defun org-expiry-insert-expiry (&optional today)
>    "Insert a property with the expiry date.
> @@ -306,15 +315,20 @@ and insert today's date."
>    (interactive "P")
>    (let* ((d (org-entry-get (point) org-expiry-expiry-property-name))
>  	 d-time d-hour)
> -    (setq d-time (if d (apply 'encode-time (org-parse-time-string d))
> +    (setq d-time (if d (org-time-string-to-time d)
>  		   (current-time)))
>      (setq d-hour (format-time-string "%H:%M" d-time))
> +    (setq timestr (if today
> +		      (format-time-string (cdr org-time-stamp-formats))
> +		    (concat "<" (org-read-date
> +				 nil nil nil nil d-time d-hour) ">")))
> +    ;; maybe transform to inactive timestamp
> +    (if org-expiry-inactive-timestamps
> +	(setq timestr (concat "[" (substring timestr 1 -1) "]")))
> +     
>      (save-excursion
>        (org-entry-put
> -       (point) org-expiry-expiry-property-name
> -       (if today (format-time-string (cdr org-time-stamp-formats))
> -	 (concat "<" (org-read-date
> -		      nil nil nil nil d-time d-hour) ">"))))))
> +       (point) org-expiry-expiry-property-name timestr))))
>  
>  ;;; Functions to process expired entries:
>  
> 

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

* Re: [PATCH] Allow inactive timestamps in org-expiry (copy of lost patch)
  2011-03-28 18:55 ` Nick Dokos
  2011-03-28 20:21   ` Marcel van der Boom
@ 2011-05-24 19:07   ` David Maus
  1 sibling, 0 replies; 5+ messages in thread
From: David Maus @ 2011-05-24 19:07 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

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

At Mon, 28 Mar 2011 14:55:13 -0400,
Nick Dokos wrote:
>
> Marcel van der Boom <marcel@hsdev.com> wrote:
>
> > This patch is what is attached to the message displayed at [1]. I have
> > been using this patch for a while and it works fine. From searching it
> > looks like this patch was 'forgotten', but I may have overlooked
> > something.
> >
> > If the patch was rejected, you can ignore me. If it was forgotten I'd
> > like to request to include it.
> >
>
> I don't think it was rejected outright, it looks as if it was
> inadvertently dropped. Probably part of the reason is that David sent
> the patches as application/octet-stream so they never made it to
> patchwork (was patchwork even running back in 2009? I don't remember
> when it was set up.)

IIRC Patchwork was set up in Summer 2010.


> The third part might be that it was Dec. 31, so people were out
> partying instead of applying patches (unimaginable, I know :-) )

Wow, I really did send this one Dec 31st 2009 - how time flies!

Best,
  -- Davdi
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

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

end of thread, other threads:[~2011-05-24 19:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-28 18:21 [PATCH] Allow inactive timestamps in org-expiry (copy of lost patch) Marcel van der Boom
2011-03-28 18:55 ` Nick Dokos
2011-03-28 20:21   ` Marcel van der Boom
2011-05-24 19:07   ` David Maus
2011-05-24 13:18 ` [Accepted] " 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).