From: David Maus <maus.david@gmail.com>
To: Bastien <bastienguerry@googlemail.com>
Cc: Org-Mode <emacs-orgmode@gnu.org>
Subject: Re: How to change CREATED property value to inactive in org-expiry
Date: Thu, 31 Dec 2009 10:54:07 +0100 [thread overview]
Message-ID: <87ljgj5v0g.wl%maus.david@gmail.com> (raw)
In-Reply-To: <87d41yuidw.fsf@bzg.ath.cx>
[-- Attachment #1.1.1: Type: text/plain, Size: 540 bytes --]
Hi Bastien,
I attached the two patches:
- 0001: Use `org-time-string-to-time' to convert timestamps to time objects
- 0002: Allow inactive timestamps
I am currently pondering whether or not it could be useful to limit
the creation of the created timestamp to todo headlines only. At least
for me a created timestamp does not make sense for a headline that is,
say, part of a document's outline.
Regards
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com
ICQ....... 241051416
[-- Attachment #1.1.2: 0001-Use-org-time-string-to-time-to-convert-timestamp-to-.patch --]
[-- Type: application/octet-stream, Size: 1306 bytes --]
From 4b85f7907fe91e3594191ef17e84cebd10073b74 Mon Sep 17 00:00:00 2001
From: David Maus <maus.david@gmail.com>
Date: Sat, 26 Dec 2009 22:14:34 +0100
Subject: [PATCH 1/2] Use `org-time-string-to-time' to convert timestamp to time object.
---
contrib/lisp/org-expiry.el | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/contrib/lisp/org-expiry.el b/contrib/lisp/org-expiry.el
index 2a6998a..41fb91c 100644
--- a/contrib/lisp/org-expiry.el
+++ b/contrib/lisp/org-expiry.el
@@ -286,8 +286,7 @@ update the date."
d-time d-hour)
(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))
(save-excursion
@@ -306,7 +305,7 @@ 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))
(save-excursion
--
1.6.5
[-- Attachment #1.1.3: 0002-Allow-inactive-timestamps-for-created-and-expired-ti.patch --]
[-- Type: application/octet-stream, Size: 3270 bytes --]
From 227625cd27bce8a7e9847df0f3773f6d41356314 Mon Sep 17 00:00:00 2001
From: David Maus <maus.david@gmail.com>
Date: Sun, 27 Dec 2009 09:45:03 +0100
Subject: [PATCH 2/2] Allow inactive timestamps for created and expired timestamps.
Add customization variable `org-expiry-inactive-timestamps'. If set to
to, org-expiry creation and expiration date as inactive timestamps.
This may be useful as entries with active timestamps are shown in the
agenda and hence may clutter up the agenda view.
---
contrib/lisp/org-expiry.el | 35 ++++++++++++++++++++++++-----------
1 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/contrib/lisp/org-expiry.el b/contrib/lisp/org-expiry.el
index 41fb91c..3be8adb 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 of created and expired time."
+ :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,20 +288,24 @@ 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
(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.
@@ -308,12 +317,16 @@ and insert today's date."
(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:
--
1.6.5
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2009-12-31 9:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-26 19:11 How to change CREATED property value to inactive in org-expiry Manish
2009-12-27 9:07 ` David Maus
2009-12-29 11:30 ` Bastien
2009-12-31 9:54 ` David Maus [this message]
2009-12-27 9:08 ` David Maus
2009-12-27 10:50 ` Manish
2009-12-28 18:48 ` Carsten Dominik
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=87ljgj5v0g.wl%maus.david@gmail.com \
--to=maus.david@gmail.com \
--cc=bastienguerry@googlemail.com \
--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).