emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* user-defined agenda sorting
@ 2009-06-16  8:57 Samuel Wales
  2009-06-16  9:13 ` Samuel Wales
  0 siblings, 1 reply; 5+ messages in thread
From: Samuel Wales @ 2009-06-16  8:57 UTC (permalink / raw)
  To: emacs-orgmode

I have a sort comparison function for the outline, which
returns a number.  This works well.

The documentation for user-defined agenda sorting says "This
function must receive two arguments, agenda entry a and b."
I am not sure what a and b are, strings?

My function gets priorities, tags, and todo kw assuming point is on a
headline.  It uses org functions to get those.  The org code for
agenda sorting uses text properties.

How to adapt my function to get the following information: priorities
as [?A..?C], inherited and local tags as a list, and todo kw as a
string?

Is there a place where how to parse a and b is documented?

Thanks.

-- 
Myalgic encephalomyelitis denialism is causing death and severe suffering,
worse than MS.  Conflicts of interest are destroying research.  /You/ can
get the disease at any time permanently.  Do science and justice matter to
you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm

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

* Re: user-defined agenda sorting
  2009-06-16  8:57 user-defined agenda sorting Samuel Wales
@ 2009-06-16  9:13 ` Samuel Wales
  2009-06-19 15:39   ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: Samuel Wales @ 2009-06-16  9:13 UTC (permalink / raw)
  To: emacs-orgmode

If my skills at cargo-cult programming can summon the air force, then
(get-text-property 1 'priority a/b] will work.  But I'm not sure if
there are functions for parsing tags etc.  Testing seems difficult as
cut and paste of headline strings seems to not include properties.

Thanks.

On Tue, Jun 16, 2009 at 01:57, Samuel Wales<samologist@gmail.com> wrote:
> I have a sort comparison function for the outline, which
> returns a number.  This works well.
>
> The documentation for user-defined agenda sorting says "This
> function must receive two arguments, agenda entry a and b."
> I am not sure what a and b are, strings?
>
> My function gets priorities, tags, and todo kw assuming point is on a
> headline.  It uses org functions to get those.  The org code for
> agenda sorting uses text properties.
>
> How to adapt my function to get the following information: priorities
> as [?A..?C], inherited and local tags as a list, and todo kw as a
> string?
>
> Is there a place where how to parse a and b is documented?
>
> Thanks.
>
> --
> Myalgic encephalomyelitis denialism is causing death and severe suffering,
> worse than MS.  Conflicts of interest are destroying research.  /You/ can
> get the disease at any time permanently.  Do science and justice matter to
> you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
>



-- 
Myalgic encephalomyelitis denialism is causing death and severe suffering,
worse than MS.  Conflicts of interest are destroying research.  /You/ can
get the disease at any time permanently.  Do science and justice matter to
you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm

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

* Re: Re: user-defined agenda sorting
  2009-06-16  9:13 ` Samuel Wales
@ 2009-06-19 15:39   ` Carsten Dominik
  2009-06-19 20:00     ` Samuel Wales
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2009-06-19 15:39 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode


On Jun 16, 2009, at 11:13 AM, Samuel Wales wrote:

> If my skills at cargo-cult programming can summon the air force, then
> (get-text-property 1 'priority a/b] will work.  But I'm not sure if
> there are functions for parsing tags etc.  Testing seems difficult as
> cut and paste of headline strings seems to not include properties.
>
> Thanks.
>
> On Tue, Jun 16, 2009 at 01:57, Samuel Wales<samologist@gmail.com>  
> wrote:
>> I have a sort comparison function for the outline, which
>> returns a number.  This works well.
>>
>> The documentation for user-defined agenda sorting says "This
>> function must receive two arguments, agenda entry a and b."
>> I am not sure what a and b are, strings?
>>
>> My function gets priorities, tags, and todo kw assuming point is on a
>> headline.  It uses org functions to get those.  The org code for
>> agenda sorting uses text properties.
>>
>> How to adapt my function to get the following information: priorities
>> as [?A..?C], inherited and local tags as a list, and todo kw as a
>> string?
>>
>> Is there a place where how to parse a and b is documented?


Not really.  `a' and `b' are the strings that are inserted into the  
agenda,
each line in the agenda may be `a' or `b'.
The strings are loaded with text properties carrying all kinds of  
information.
You can look at these properties by pressing `C-u C-x =' on a line in  
the agenda.
If the information you want is not there, you can take the
org-morker and org-hd-marker properties to visit the original entries  
and
get the needed info from there.  And example for this is in `org-cmp- 
todo-state'
which returns to the original buffer in order to get the buffer-local
list of TODO states from there.

All the org-cmp-.... functions contain examples on how the text  
properties
are used from comparing entries.

The reason why these are in different text properties is historic,  
because I
added this stuff one by one, over time.  Looking back, a single  
property list
would have been better for tasks like the one you are working on.

HTH

- Carsten

>>
>> Thanks.
>>
>> --
>> Myalgic encephalomyelitis denialism is causing death and severe  
>> suffering,
>> worse than MS.  Conflicts of interest are destroying research.  / 
>> You/ can
>> get the disease at any time permanently.  Do science and justice  
>> matter to
>> you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
>>
>
>
>
> -- 
> Myalgic encephalomyelitis denialism is causing death and severe  
> suffering,
> worse than MS.  Conflicts of interest are destroying research.  / 
> You/ can
> get the disease at any time permanently.  Do science and justice  
> matter to
> you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
>
>
> _______________________________________________
> 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] 5+ messages in thread

* Re: Re: user-defined agenda sorting
  2009-06-19 15:39   ` Carsten Dominik
@ 2009-06-19 20:00     ` Samuel Wales
  2009-06-20  4:12       ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: Samuel Wales @ 2009-06-19 20:00 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Thanks.

Just to confirm, to get the inherited tags and the priority letter, I
have to go to the original buffer?

On Fri, Jun 19, 2009 at 08:39, Carsten Dominik<carsten.dominik@gmail.com> wrote:
>
> On Jun 16, 2009, at 11:13 AM, Samuel Wales wrote:
>
>> If my skills at cargo-cult programming can summon the air force, then
>> (get-text-property 1 'priority a/b] will work.  But I'm not sure if
>> there are functions for parsing tags etc.  Testing seems difficult as
>> cut and paste of headline strings seems to not include properties.
>>
>> Thanks.
>>
>> On Tue, Jun 16, 2009 at 01:57, Samuel Wales<samologist@gmail.com> wrote:
>>>
>>> I have a sort comparison function for the outline, which
>>> returns a number.  This works well.
>>>
>>> The documentation for user-defined agenda sorting says "This
>>> function must receive two arguments, agenda entry a and b."
>>> I am not sure what a and b are, strings?
>>>
>>> My function gets priorities, tags, and todo kw assuming point is on a
>>> headline.  It uses org functions to get those.  The org code for
>>> agenda sorting uses text properties.
>>>
>>> How to adapt my function to get the following information: priorities
>>> as [?A..?C], inherited and local tags as a list, and todo kw as a
>>> string?
>>>
>>> Is there a place where how to parse a and b is documented?
>
>
> Not really.  `a' and `b' are the strings that are inserted into the agenda,
> each line in the agenda may be `a' or `b'.
> The strings are loaded with text properties carrying all kinds of
> information.
> You can look at these properties by pressing `C-u C-x =' on a line in the
> agenda.
> If the information you want is not there, you can take the
> org-morker and org-hd-marker properties to visit the original entries and
> get the needed info from there.  And example for this is in
> `org-cmp-todo-state'
> which returns to the original buffer in order to get the buffer-local
> list of TODO states from there.
>
> All the org-cmp-.... functions contain examples on how the text properties
> are used from comparing entries.
>
> The reason why these are in different text properties is historic, because I
> added this stuff one by one, over time.  Looking back, a single property
> list
> would have been better for tasks like the one you are working on.
>
> HTH
>
> - Carsten
>
>>>
>>> Thanks.
>>>
>>> --
>>> Myalgic encephalomyelitis denialism is causing death and severe
>>> suffering,
>>> worse than MS.  Conflicts of interest are destroying research.  /You/ can
>>> get the disease at any time permanently.  Do science and justice matter
>>> to
>>> you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
>>>
>>
>>
>>
>> --
>> Myalgic encephalomyelitis denialism is causing death and severe suffering,
>> worse than MS.  Conflicts of interest are destroying research.  /You/ can
>> get the disease at any time permanently.  Do science and justice matter to
>> you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
>>
>>
>> _______________________________________________
>> 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
>
>



-- 
Myalgic encephalomyelitis denialism is causing death and severe suffering,
worse than MS.  Conflicts of interest are destroying research.  /You/ can
get the disease at any time permanently.  Do science and justice matter to
you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm

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

* Re: Re: user-defined agenda sorting
  2009-06-19 20:00     ` Samuel Wales
@ 2009-06-20  4:12       ` Carsten Dominik
  0 siblings, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-06-20  4:12 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode


On Jun 19, 2009, at 10:00 PM, Samuel Wales wrote:

> Thanks.
>
> Just to confirm, to get the inherited tags and the priority letter, I
> have to go to the original buffer?

No.  The priority letter is still in the string, you can use a regular  
expression to
get it directly from a

   (or (and (string-match "\\[#\\([ABC]\\)\\]" a) (match-string 1 a))
       "B")

The text property tags contains a list of all tags, the inherited tags  
carry
a text peroperty `inherited'.

HTH

- Carsten


>
> On Fri, Jun 19, 2009 at 08:39, Carsten Dominik<carsten.dominik@gmail.com 
> > wrote:
>>
>> On Jun 16, 2009, at 11:13 AM, Samuel Wales wrote:
>>
>>> If my skills at cargo-cult programming can summon the air force,  
>>> then
>>> (get-text-property 1 'priority a/b] will work.  But I'm not sure if
>>> there are functions for parsing tags etc.  Testing seems difficult  
>>> as
>>> cut and paste of headline strings seems to not include properties.
>>>
>>> Thanks.
>>>
>>> On Tue, Jun 16, 2009 at 01:57, Samuel Wales<samologist@gmail.com>  
>>> wrote:
>>>>
>>>> I have a sort comparison function for the outline, which
>>>> returns a number.  This works well.
>>>>
>>>> The documentation for user-defined agenda sorting says "This
>>>> function must receive two arguments, agenda entry a and b."
>>>> I am not sure what a and b are, strings?
>>>>
>>>> My function gets priorities, tags, and todo kw assuming point is  
>>>> on a
>>>> headline.  It uses org functions to get those.  The org code for
>>>> agenda sorting uses text properties.
>>>>
>>>> How to adapt my function to get the following information:  
>>>> priorities
>>>> as [?A..?C], inherited and local tags as a list, and todo kw as a
>>>> string?
>>>>
>>>> Is there a place where how to parse a and b is documented?
>>
>>
>> Not really.  `a' and `b' are the strings that are inserted into the  
>> agenda,
>> each line in the agenda may be `a' or `b'.
>> The strings are loaded with text properties carrying all kinds of
>> information.
>> You can look at these properties by pressing `C-u C-x =' on a line  
>> in the
>> agenda.
>> If the information you want is not there, you can take the
>> org-morker and org-hd-marker properties to visit the original  
>> entries and
>> get the needed info from there.  And example for this is in
>> `org-cmp-todo-state'
>> which returns to the original buffer in order to get the buffer-local
>> list of TODO states from there.
>>
>> All the org-cmp-.... functions contain examples on how the text  
>> properties
>> are used from comparing entries.
>>
>> The reason why these are in different text properties is historic,  
>> because I
>> added this stuff one by one, over time.  Looking back, a single  
>> property
>> list
>> would have been better for tasks like the one you are working on.
>>
>> HTH
>>
>> - Carsten
>>
>>>>
>>>> Thanks.
>>>>
>>>> --
>>>> Myalgic encephalomyelitis denialism is causing death and severe
>>>> suffering,
>>>> worse than MS.  Conflicts of interest are destroying research.  / 
>>>> You/ can
>>>> get the disease at any time permanently.  Do science and justice  
>>>> matter
>>>> to
>>>> you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
>>>>
>>>
>>>
>>>
>>> --
>>> Myalgic encephalomyelitis denialism is causing death and severe  
>>> suffering,
>>> worse than MS.  Conflicts of interest are destroying research.  / 
>>> You/ can
>>> get the disease at any time permanently.  Do science and justice  
>>> matter to
>>> you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
>
> -- 
> Myalgic encephalomyelitis denialism is causing death and severe  
> suffering,
> worse than MS.  Conflicts of interest are destroying research.  / 
> You/ can
> get the disease at any time permanently.  Do science and justice  
> matter to
> you?  http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm

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

end of thread, other threads:[~2009-06-20  4:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16  8:57 user-defined agenda sorting Samuel Wales
2009-06-16  9:13 ` Samuel Wales
2009-06-19 15:39   ` Carsten Dominik
2009-06-19 20:00     ` Samuel Wales
2009-06-20  4: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).