emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-expiry: How to define keyword for org-expiry-add-keyword
@ 2010-01-04 19:37 Markus Heller
  2010-01-05 16:47 ` David Maus
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Heller @ 2010-01-04 19:37 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

please help a newbie with org-expiry.el :)

I have a file like this:

expiry.org

* ACTIVE Test task
   :PROPERTIES:
     :EXPIRY: <2010-01-04 Mon 11:12>
   :END:

I want org-expiry to change the keyword from ACTIVE to EXPIRED.  These 
keywords are defined in my .emacs as follows:

(setq org-todo-keywords
    (quote ((sequence "TODO(t)" "STARTED(s!)" "WAITING(w@/@)" 
"APPT(a@/!)" "|" "DONE(d@/@)" "CANCELED(c@/@)" "DEFERRED(f)")
            (sequence "ACTIVE" "|" "EXPIRED"))))

If I type M-x org-expiry-process-entries in expiry.org, I get the 
following error:

Symbol's function definition is void: org-expiry-handler function

I have defined this to be org-expiry-add-keyword, but how do I define 
the actual keyword?

Thanks
Markus

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

* Re: Org-expiry: How to define keyword for org-expiry-add-keyword
  2010-01-04 19:37 Org-expiry: How to define keyword for org-expiry-add-keyword Markus Heller
@ 2010-01-05 16:47 ` David Maus
  2010-01-05 23:26   ` Markus Heller
  0 siblings, 1 reply; 6+ messages in thread
From: David Maus @ 2010-01-05 16:47 UTC (permalink / raw)
  To: Markus Heller; +Cc: Bastien, emacs-orgmode


[-- Attachment #1.1.1: Type: text/plain, Size: 742 bytes --]

Hi Markus,

At Mon, 04 Jan 2010 11:37:45 -0800,
Markus Heller wrote:
>
> If I type M-x org-expiry-process-entries in expiry.org, I get the
> following error:
>
> Symbol's function definition is void: org-expiry-handler function

This actually is a bug in org-expiry.el that is fixed with the
attached patch.

>
> I have defined this to be org-expiry-add-keyword, but how do I define
> the actual keyword?
>

You can define the keyword by setting the variable
`org-expiry-keyword'

,----
| (setq org-expiry-keyword "KEYWORD")
`----

or of cause using customization-interface (M-x customize-group RET
org-expiry RET).

 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com
ICQ....... 241051416

[-- Attachment #1.1.2: 0001-Fix-call-to-function-defined-in-org-expiry-handler-f.patch --]
[-- Type: application/octet-stream, Size: 868 bytes --]

From 1a2d5ef20714c8b7d40baf52ca80ca28cb04ce92 Mon Sep 17 00:00:00 2001
From: David Maus <maus.david@gmail.com>
Date: Tue, 5 Jan 2010 17:29:38 +0100
Subject: [PATCH] Fix call to function defined in org-expiry-handler-function.

---
 contrib/lisp/org-expiry.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/lisp/org-expiry.el b/contrib/lisp/org-expiry.el
index 2a6998a..828e287 100644
--- a/contrib/lisp/org-expiry.el
+++ b/contrib/lisp/org-expiry.el
@@ -247,7 +247,7 @@ Otherwise rely on `org-expiry-confirm-flag' to decide."
 		     (not (interactive)))
 		(and org-expiry-confirm-flag
 		     (y-or-n-p (format "Entry expired by %d days.  Process? " d))))
-	  (funcall 'org-expiry-handler-function))
+	  (funcall org-expiry-handler-function))
 	(org-delete-overlay ov)))))
 
 (defun org-expiry-process-entries (beg end)
-- 
1.6.5


[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 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

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

* Re: Org-expiry: How to define keyword for org-expiry-add-keyword
  2010-01-05 16:47 ` David Maus
@ 2010-01-05 23:26   ` Markus Heller
  2010-01-07 17:01     ` David Maus
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Heller @ 2010-01-05 23:26 UTC (permalink / raw)
  To: emacs-orgmode

On 1/5/2010 8:47 AM, David Maus wrote:
> Hi Markus,
>
> At Mon, 04 Jan 2010 11:37:45 -0800,
> Markus Heller wrote:
>>
>> If I type M-x org-expiry-process-entries in expiry.org, I get the
>> following error:
>>
>> Symbol's function definition is void: org-expiry-handler function
>
> This actually is a bug in org-expiry.el that is fixed with the
> attached patch.

Thanks for the patch.

But when I run M-x org-expiry-process-entries in the agenda or in my 
example file (see below), I get the following message in the minibuffer:

"The mark is not set now, so there is no region"

When I run M-x org-expiry-process-entry in my example file (see below), 
it works!  This command doesn't work in the agenda, but this is by 
design, right?

Am I correct in assuming that I should be able to use M-x 
org-expiry-process-entries in the agenda?

Thanks and Cheers
Markus

>>
>> I have defined this to be org-expiry-add-keyword, but how do I define
>> the actual keyword?
>>
>
> You can define the keyword by setting the variable
> `org-expiry-keyword'
>
> ,----
> | (setq org-expiry-keyword "KEYWORD")
> `----
>
> or of cause using customization-interface (M-x customize-group RET
> org-expiry RET).
>
>   -- David
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... maus.david@gmail.com
> ICQ....... 241051416
>
>
>
> _______________________________________________
> 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

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

* Re: Re: Org-expiry: How to define keyword for org-expiry-add-keyword
  2010-01-05 23:26   ` Markus Heller
@ 2010-01-07 17:01     ` David Maus
  2010-01-07 17:57       ` Markus Heller
  2010-01-10 15:30       ` David Maus
  0 siblings, 2 replies; 6+ messages in thread
From: David Maus @ 2010-01-07 17:01 UTC (permalink / raw)
  To: Markus Heller; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1607 bytes --]

At Tue, 05 Jan 2010 15:26:06 -0800,
Markus Heller wrote:
>
> On 1/5/2010 8:47 AM, David Maus wrote:
> > Hi Markus,
> >
> > At Mon, 04 Jan 2010 11:37:45 -0800,
> > Markus Heller wrote:
> >>
> >> If I type M-x org-expiry-process-entries in expiry.org, I get the
> >> following error:
> >>
> >> Symbol's function definition is void: org-expiry-handler function
> >
> > This actually is a bug in org-expiry.el that is fixed with the
> > attached patch.
>
> Thanks for the patch.
>
> But when I run M-x org-expiry-process-entries in the agenda or in my
> example file (see below), I get the following message in the minibuffer:
>
> "The mark is not set now, so there is no region"
>
> When I run M-x org-expiry-process-entry in my example file (see below),
> it works!  This command doesn't work in the agenda, but this is by
> design, right?
>
> Am I correct in assuming that I should be able to use M-x
> org-expiry-process-entries in the agenda?

No. Up to now org-expiry is constructed to work on a per file basis
and `org-expiry-process-entries' even expects the headlines to process
in a region. That is what the first message "The mark is not set now,
so there is no region" complains about.

It seems reasonable to me that org-expiry should provide a function
that processes all headlines in a buffer and processing all headlines
in an agenda view.

Could I ask you to elaborate on the intended use of org-expiry? I'm
not quite sure about how expiry fits in the overall concept of
orgmode.

Regards

 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 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

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

* Re: Org-expiry: How to define keyword for org-expiry-add-keyword
  2010-01-07 17:01     ` David Maus
@ 2010-01-07 17:57       ` Markus Heller
  2010-01-10 15:30       ` David Maus
  1 sibling, 0 replies; 6+ messages in thread
From: Markus Heller @ 2010-01-07 17:57 UTC (permalink / raw)
  To: emacs-orgmode

On 1/7/2010 9:01 AM, David Maus wrote:
> At Tue, 05 Jan 2010 15:26:06 -0800,
> Markus Heller wrote:
>>
>> On 1/5/2010 8:47 AM, David Maus wrote:
>>> Hi Markus,
>>>
>>> At Mon, 04 Jan 2010 11:37:45 -0800,
>>> Markus Heller wrote:
>>>>
>>>> If I type M-x org-expiry-process-entries in expiry.org, I get the
>>>> following error:
>>>>
>>>> Symbol's function definition is void: org-expiry-handler function
>>>
>>> This actually is a bug in org-expiry.el that is fixed with the
>>> attached patch.
>>
>> Thanks for the patch.
>>
>> But when I run M-x org-expiry-process-entries in the agenda or in my
>> example file (see below), I get the following message in the minibuffer:
>>
>> "The mark is not set now, so there is no region"
>>
>> When I run M-x org-expiry-process-entry in my example file (see below),
>> it works!  This command doesn't work in the agenda, but this is by
>> design, right?
>>
>> Am I correct in assuming that I should be able to use M-x
>> org-expiry-process-entries in the agenda?
>
> No. Up to now org-expiry is constructed to work on a per file basis
> and `org-expiry-process-entries' even expects the headlines to process
> in a region. That is what the first message "The mark is not set now,
> so there is no region" complains about.
>
> It seems reasonable to me that org-expiry should provide a function
> that processes all headlines in a buffer and processing all headlines
> in an agenda view.
>
> Could I ask you to elaborate on the intended use of org-expiry? I'm
> not quite sure about how expiry fits in the overall concept of
> orgmode.
>

Hi David,

in the thread "Contracts in org-mode" (Message-ID: 
<hgohio$dk8$1@ger.gmane.org>), org-expiry was brought to my attention.

Here's a description of what I try to achieve:  I have several 
Workorders (WO) with different clients.  I only can do work for them if 
a WO has been signed and is active.  In my org files, such a WO gets the 
keyword "ACTIVE".  When a WO expires, it gets a keyword "EXPIRED".  I 
have agenda views for "ACTIVE" and "EXPIRED" so that I can see at one 
glance what is active and what needs to be renewed.

Right now, I manually change the keyword from ACTIVE to EXPIRED (see my 
example file at the end), but it would be awesome, i.e. really helpful 
if I could use the agenda view with all ACTIVE WOs and do M-x 
org-expiry-process-entries.

Does this elaboration make sense to you?  I'm open for any kinds of 
suggestions here ...

Thanks
Markus

Example file (needs org-depend):

* Workorder WOyyyy
** TODO Create WO
    :PROPERTIES:
      :ID: WOyyyy-Create
      :TRIGGER: WOyyyy-Sign(TODO)
    :END:
** PI Signature
    :PROPERTIES:
      :ID: WOyyyy-Sign
      :BLOCKER: WOyyyy-Create
      :TRIGGER: WOyyyy-Service(ACTIVE) WOyyyy-Analysis(ACTIVE) 
WOyyyy-Renew(TODO) WOyyyy-Expire(TODO)
    :END:
** Renew WO
    DEADLINE: <2010-03-31 Wed>
    :PROPERTIES:
      :ID: WOyyyy-Renew
      :BLOCKER: WOyyyy-Sign
    :END:
** Expire WO
    DEADLINE: <2010-03-31 Wed>
    :PROPERTIES:
      :ID: WOyyyy-Expire
      :BLOCKER: WOyyyy-Sign
      :TRIGGER: WOyyyy-Service(EXPIRED) WOyyyy-Analysis(EXPIRED)
    :END:
** Service NMR
    :PROPERTIES:
      :ID: WOyyyy-Service
      :BLOCKER: WOyyyy-Sign
    :END:
** Data Analysis
    :PROPERTIES:
      :ID: WOyyyy-Analysis
      :BLOCKER: WOyyyy-Sign
    :END:

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

* Re: Re: Org-expiry: How to define keyword for org-expiry-add-keyword
  2010-01-07 17:01     ` David Maus
  2010-01-07 17:57       ` Markus Heller
@ 2010-01-10 15:30       ` David Maus
  1 sibling, 0 replies; 6+ messages in thread
From: David Maus @ 2010-01-10 15:30 UTC (permalink / raw)
  To: David Maus; +Cc: Markus Heller, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2078 bytes --]

At Thu, 07 Jan 2010 18:01:11 +0100,
David Maus wrote:
>
> [1  <text/plain; US-ASCII (7bit)>]
> At Tue, 05 Jan 2010 15:26:06 -0800,
> Markus Heller wrote:
> >
> >
> > But when I run M-x org-expiry-process-entries in the agenda or in my
> > example file (see below), I get the following message in the minibuffer:
> >
> > "The mark is not set now, so there is no region"
> >
>
> [...]
>
> No. Up to now org-expiry is constructed to work on a per file basis
> and `org-expiry-process-entries' even expects the headlines to process
> in a region. That is what the first message "The mark is not set now,
> so there is no region" complains about.

Actually I have to correct myself: That `org-expiry-process-entries'
/requires/ mark to be set seems like a bug:

,----
| (defun org-expiry-process-entries (beg end)
|   "Process all expired entries between BEG and END.
| The expiry process will run the function defined by
| `org-expiry-handler-functions'."
|   (interactive "r")
|   (save-excursion
|     (let ((beg (if (org-region-active-p)
| 		   (region-beginning) (point-min)))
| 	  (end (if (org-region-active-p)
| 		   (region-end) (point-max))))
| ...
`----

beg and end are mandatory parameters and (interactive "r") sets beg
and end to beginning and end of region respectively. But as far as I
understand the source (tm), the function parameters are not used
because the let-statement defines two local variables beg and end
depending on whether there is an active region or not.

But if there is no region active the (interactive "r") complains about
no region and terminates the function. So the else statements in the
if clauses are never used, right?

So `org-expiry-process-entries' should read:

,----
| (defun org-expiry-process-entries ()
|   "Process all expired entries between BEG and END.
| The expiry process will run the function defined by
| `org-expiry-handler-functions'."
|   (interactive)
|   (save-excursion
| ...
`----

Or am I missing something?

 -- David

--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 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

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

end of thread, other threads:[~2010-01-10 15:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-04 19:37 Org-expiry: How to define keyword for org-expiry-add-keyword Markus Heller
2010-01-05 16:47 ` David Maus
2010-01-05 23:26   ` Markus Heller
2010-01-07 17:01     ` David Maus
2010-01-07 17:57       ` Markus Heller
2010-01-10 15:30       ` David Maus

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