emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How do I define `org-agenda-cmp-user-defined'?
@ 2014-04-18 11:20 Alan Schmitt
  2014-04-18 13:21 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2014-04-18 11:20 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I'm working on a way to schedule reviews of projects, and I would like
to have them ordered by age in an agenda view. It seems that I want to
write my own `org-agenda-cmp-user-defined' function to do so.
Unfortunately I cannot find an example of such a function.

More precisely, given this:

,-----------------------------------------------------------------
| (defun org-review-schedule-compare (a b)                        
|   "Compares the date of scheduled review for the two agenda     
|   entries. Returns +1 if A has been scheduled for longer, nil if
|   they have been scheduled for the same length of time, and -1  
|   otherwise."                                                   
|   ())                                                           
`-----------------------------------------------------------------

how can I access a property of `a' and `b'? (The documentation tells me
they are "agenda entries", but it's not clear how I can access their
information.)

Thanks a lot,

Alan

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

* Re: How do I define `org-agenda-cmp-user-defined'?
  2014-04-18 11:20 How do I define `org-agenda-cmp-user-defined'? Alan Schmitt
@ 2014-04-18 13:21 ` Bastien
  2014-04-18 17:14   ` Alan Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2014-04-18 13:21 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> More precisely, given this:
>
> ,-----------------------------------------------------------------
> | (defun org-review-schedule-compare (a b)                        
> |   "Compares the date of scheduled review for the two agenda     
> |   entries. Returns +1 if A has been scheduled for longer, nil if
> |   they have been scheduled for the same length of time, and -1  
> |   otherwise."                                                   
> |   ())                                                           
> `-----------------------------------------------------------------
>
> how can I access a property of `a' and `b'?

See how `org-cmp-alpha' works.

> (The documentation tells me they are "agenda entries", but it's not
> clear how I can access their information.)

You can access agenda entries information by text properties.

Create an agenda view, then C-u C-x = on some entry: you will see
the list of available text properties that you can manipulate.

-- 
 Bastien

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

* Re: How do I define `org-agenda-cmp-user-defined'?
  2014-04-18 13:21 ` Bastien
@ 2014-04-18 17:14   ` Alan Schmitt
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Schmitt @ 2014-04-18 17:14 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On 2014-04-18 15:21, Bastien <bzg@gnu.org> writes:

> Hi Alan,
>
> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> More precisely, given this:
>>
>> ,-----------------------------------------------------------------
>> | (defun org-review-schedule-compare (a b)                        
>> |   "Compares the date of scheduled review for the two agenda     
>> |   entries. Returns +1 if A has been scheduled for longer, nil if
>> |   they have been scheduled for the same length of time, and -1  
>> |   otherwise."                                                   
>> |   ())                                                           
>> `-----------------------------------------------------------------
>>
>> how can I access a property of `a' and `b'?
>
> See how `org-cmp-alpha' works.

Thank you for the suggestion, this is good inspiration.

>> (The documentation tells me they are "agenda entries", but it's not
>> clear how I can access their information.)
>
> You can access agenda entries information by text properties.
>
> Create an agenda view, then C-u C-x = on some entry: you will see
> the list of available text properties that you can manipulate.

Thanks a lot, I'm able to get the information I need, thanks to
`org-marker' and `org-entry-get'.

Alan

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

end of thread, other threads:[~2014-04-18 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-18 11:20 How do I define `org-agenda-cmp-user-defined'? Alan Schmitt
2014-04-18 13:21 ` Bastien
2014-04-18 17:14   ` Alan Schmitt

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