emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Several %(expression) in org-agenda-prefix-format
@ 2016-04-14 13:02 laurent.jucquois
  2016-04-14 21:12 ` Adam Porter
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: laurent.jucquois @ 2016-04-14 13:02 UTC (permalink / raw)
  To: org-mode-email

Hi list,

I'm trying to setup some custom agenda views that would be useful for my 
work but i'm unable to define a custom org-agenda-prefix-format with 
several %expression successfully.

My org-file is as follow:

* Pierre Dupond v. Belgian State
:PROPERTIES:
:Case: Dupond
:Location: Court of XX
:FiscalYear: 13-14
:CaseNum: 15/RG/139
:END:

** My first pleadings
DEADLINE: <2016-05-15 mon.>
** Pleading from Belgian State
** My second pleadings
** etc.

When I check my agenda, it doesn't serve me at all to see the general 
description "** My first pleadings" if I don't know to which case it 
relates.

So, I'm trying to setup a custom agenda view that would look like this:

Dupond 15/RG/139 (13-14) : My first pleadings

I've come up with the following (mal-functionning) 
org-agenda-prefix-format:

%(org-get-entry (point) "Case" t) %(org-entry-get (point) "CaseNum" t) 
%(org-entry-get (point) "FiscalYear" t)

But this only gives me :

Dupond : My first pleadings

I would really appreciate that someone points me into the right 
direction.

Thanks,

Laurent

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-14 13:02 Several %(expression) in org-agenda-prefix-format laurent.jucquois
@ 2016-04-14 21:12 ` Adam Porter
  2016-04-15  8:16   ` laurent.jucquois
  2016-04-14 22:37 ` Christophe Schockaert
  2016-04-15 16:00 ` Ken Mankoff
  2 siblings, 1 reply; 12+ messages in thread
From: Adam Porter @ 2016-04-14 21:12 UTC (permalink / raw)
  To: emacs-orgmode

laurent.jucquois@posteo.de writes:

> I've come up with the following (mal-functionning)
> org-agenda-prefix-format:
>
> %(org-get-entry (point) "Case" t) %(org-entry-get (point) "CaseNum" t)
> %(org-entry-get (point) "FiscalYear" t)
>
> But this only gives me :
>
> Dupond : My first pleadings

Hi Laurent,

I noticed that you're using both `org-get-entry' and `org-entry-get'.
According to the docs, only `org-entry-get' should do what you want, but
your output seems to indicate the opposite.  I'm not sure what to make
of that, but maybe this is a clue to the problem...?

Please let us know how you fix it.  I've been wanting to try something
like that myself.

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-14 13:02 Several %(expression) in org-agenda-prefix-format laurent.jucquois
  2016-04-14 21:12 ` Adam Porter
@ 2016-04-14 22:37 ` Christophe Schockaert
  2016-04-15  8:10   ` laurent.jucquois
  2016-04-15 16:00 ` Ken Mankoff
  2 siblings, 1 reply; 12+ messages in thread
From: Christophe Schockaert @ 2016-04-14 22:37 UTC (permalink / raw)
  To: laurent.jucquois; +Cc: org-mode-email


laurent.jucquois@posteo.de writes:

> Hi list,
>
> I'm trying to setup some custom agenda views that would be useful for my 
> work but i'm unable to define a custom org-agenda-prefix-format with 
> several %expression successfully.
>
[...]
> I've come up with the following (mal-functionning) 
> org-agenda-prefix-format:
>
> %(org-get-entry (point) "Case" t) %(org-entry-get (point) "CaseNum" t) 
> %(org-entry-get (point) "FiscalYear" t)

Hi Laurent,

I encountered the same limitation when I tried something alike.

I finally solved it using 'concat' in one unique %expression :

(org-agenda-prefix-format
  "%((concat (or (org-entry-get (point) \"Case\" t) \"\") \" \"
             (or (org-entry-get (point) \"CaseNum\" t) \"\") \" \"
             (or (org-entry-get (point) \"FiscalYear\" t) \"\") \" \"))")

For better readability in the agenda, or more complex expressions, I
thought I could write an entire function for handling them, but I never
dit.

> I would really appreciate that someone points me into the right 
> direction.
>
> Thanks,
>
> Laurent
Well, I hope you'll be able to get something from this direction :-)

Christophe

-- 
--------------->  mailto:R3vLibre@citadels.eu
Once it's perfectly aimed, the flying arrow goes straight to its target.
Thus, don't worry when things go right.
There will be enough time to worry about if they go wrong.
Then, it's time to fire a new arrow towards another direction.
Don't sink.  Adapt yourself !  The archer has to shoot accurately and quickly.
[Words of Erenthar, the bowman ranger] <---------------<<<<

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-14 22:37 ` Christophe Schockaert
@ 2016-04-15  8:10   ` laurent.jucquois
  2016-04-15 14:44     ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: laurent.jucquois @ 2016-04-15  8:10 UTC (permalink / raw)
  To: Christophe Schockaert; +Cc: Emacs-orgmode, org-mode-email

Hi Christophe,

Thanks for the pointer!

I had already tried this solution but I wasn't entirely satisfied 
because of alignment reasons.

Not all my properties have the same length, so my agenda now looks like 
this:

DUPOND 12/RG/569 (10) : My task
DURAND 16/1689/A (05; 10-12; 14) : My task

So it's better than not knowing to which case my todos relate but it 
isn't ideal for readability.

Do you know if, like org-agenda-prefix-format, I could align the result 
of concat or define the number of character the first string can occupy?

Thanks in advance,

Laurent

Am 15.04.2016 00:37 schrieb Christophe Schockaert:
> laurent.jucquois@posteo.de writes:
> 
>> Hi list,
>> 
>> I'm trying to setup some custom agenda views that would be useful for 
>> my
>> work but i'm unable to define a custom org-agenda-prefix-format with
>> several %expression successfully.
>> 
> [...]
>> I've come up with the following (mal-functionning)
>> org-agenda-prefix-format:
>> 
>> %(org-get-entry (point) "Case" t) %(org-entry-get (point) "CaseNum" t)
>> %(org-entry-get (point) "FiscalYear" t)
> 
> Hi Laurent,
> 
> I encountered the same limitation when I tried something alike.
> 
> I finally solved it using 'concat' in one unique %expression :
> 
> (org-agenda-prefix-format
>   "%((concat (or (org-entry-get (point) \"Case\" t) \"\") \" \"
>              (or (org-entry-get (point) \"CaseNum\" t) \"\") \" \"
>              (or (org-entry-get (point) \"FiscalYear\" t) \"\") \" 
> \"))")
> 
> For better readability in the agenda, or more complex expressions, I
> thought I could write an entire function for handling them, but I never
> dit.
> 
>> I would really appreciate that someone points me into the right
>> direction.
>> 
>> Thanks,
>> 
>> Laurent
> Well, I hope you'll be able to get something from this direction :-)
> 
> Christophe

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-14 21:12 ` Adam Porter
@ 2016-04-15  8:16   ` laurent.jucquois
  0 siblings, 0 replies; 12+ messages in thread
From: laurent.jucquois @ 2016-04-15  8:16 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-orgmode

Hi Adam,

I messed up my example, I meant to write 'org-entry-get'.

Sadly, the problem doesn't come from there.

Like Christophe suggested, I guess I'll satisfy myself with a concat 
expression of all the properties I need, which is not ideal for 
readability (not all my properties have the same length).

Maybe this could be reported as a bug or maybe the documentation should 
be upgraded if one is only allowed to pass 'org-agenda-prefix-format' 
one custom %(expression).

Anyway, I'm really far far away from being able to understand what's 
going on under the hood of 'org-agenda-prefix-format' to solve this 
problem myself.

But I hope someone will (or maybe I will when I've finally learned 
enough lisp)!

Cheers,

Laurent

Am 14.04.2016 23:12 schrieb Adam Porter:
> laurent.jucquois@posteo.de writes:
> 
>> I've come up with the following (mal-functionning)
>> org-agenda-prefix-format:
>> 
>> %(org-get-entry (point) "Case" t) %(org-entry-get (point) "CaseNum" t)
>> %(org-entry-get (point) "FiscalYear" t)
>> 
>> But this only gives me :
>> 
>> Dupond : My first pleadings
> 
> Hi Laurent,
> 
> I noticed that you're using both `org-get-entry' and `org-entry-get'.
> According to the docs, only `org-entry-get' should do what you want, 
> but
> your output seems to indicate the opposite.  I'm not sure what to make
> of that, but maybe this is a clue to the problem...?
> 
> Please let us know how you fix it.  I've been wanting to try something
> like that myself.

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-15  8:10   ` laurent.jucquois
@ 2016-04-15 14:44     ` Nick Dokos
  2016-04-15 15:52       ` Christophe Schockaert
  2016-04-15 15:56       ` laurent.jucquois
  0 siblings, 2 replies; 12+ messages in thread
From: Nick Dokos @ 2016-04-15 14:44 UTC (permalink / raw)
  To: emacs-orgmode

laurent.jucquois@posteo.de writes:

> Hi Christophe,
>
> Thanks for the pointer!
>
> I had already tried this solution but I wasn't entirely satisfied
> because of alignment reasons.
>
> Not all my properties have the same length, so my agenda now looks
> like this:
>
> DUPOND 12/RG/569 (10) : My task
> DURAND 16/1689/A (05; 10-12; 14) : My task
>
> So it's better than not knowing to which case my todos relate but it
> isn't ideal for readability.
>
> Do you know if, like org-agenda-prefix-format, I could align the
> result of concat or define the number of character the first string
> can occupy?
>

Can't you use something like:

   (format "%-40s" (concat ...))

?

--
Nick

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-15 14:44     ` Nick Dokos
@ 2016-04-15 15:52       ` Christophe Schockaert
  2016-04-15 15:56       ` laurent.jucquois
  1 sibling, 0 replies; 12+ messages in thread
From: Christophe Schockaert @ 2016-04-15 15:52 UTC (permalink / raw)
  To: emacs-orgmode


Nick Dokos writes:

> laurent.jucquois@posteo.de writes:
>
>> Hi Christophe,
>>
>> Thanks for the pointer!
>>
>> I had already tried this solution but I wasn't entirely satisfied
>> because of alignment reasons.
>>
[...]
> Can't you use something like:
>
>    (format "%-40s" (concat ...))
>
> ?
Laurent,


Glad you went further.

As Nikos said, for alignment, you can use 'format', and maybe build a
wholly formated string :

(format "%-10s%-24s%-20s" (concat (org-entry-get "prop1"))
                          (concat ...)
                           ...)

in order to get something like :

DUPOND    12/RG/569     (10)                : My task
DURAND    16/1689/A     (05; 10-12; 14)     : My task


I don't know how you want your display to render in the end, but
'format' will allow you quite much flexibility.

Regards,
Christophe

-- 
--------------->  mailto:R3vLibre@citadels.eu
Once it's perfectly aimed, the flying arrow goes straight to its target.
Thus, don't worry when things go right.
There will be enough time to worry about if they go wrong.
Then, it's time to fire a new arrow towards another direction.
Don't sink.  Adapt yourself !  The archer has to shoot accurately and quickly.
[Words of Erenthar, the bowman ranger] <---------------<<<<

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-15 14:44     ` Nick Dokos
  2016-04-15 15:52       ` Christophe Schockaert
@ 2016-04-15 15:56       ` laurent.jucquois
  1 sibling, 0 replies; 12+ messages in thread
From: laurent.jucquois @ 2016-04-15 15:56 UTC (permalink / raw)
  To: Nick Dokos; +Cc: Emacs-orgmode, emacs-orgmode

Hi Nick,

That is indeed what I needed !

Here is what I've come up with:

(format "%-12s %-12s %-8s" (or (org-entry-get (point) "Case" t) "--") 
(or (org-entry-get (point) "CaseNum" t) "--") (or (org-entry-get (point) 
"FiscalYear" t) "--"))

It does exactly what I wanted, so thanks for the pointer!

Laurent

Am 15.04.2016 16:44 schrieb Nick Dokos:
> laurent.jucquois@posteo.de writes:
> 
>> Hi Christophe,
>> 
>> Thanks for the pointer!
>> 
>> I had already tried this solution but I wasn't entirely satisfied
>> because of alignment reasons.
>> 
>> Not all my properties have the same length, so my agenda now looks
>> like this:
>> 
>> DUPOND 12/RG/569 (10) : My task
>> DURAND 16/1689/A (05; 10-12; 14) : My task
>> 
>> So it's better than not knowing to which case my todos relate but it
>> isn't ideal for readability.
>> 
>> Do you know if, like org-agenda-prefix-format, I could align the
>> result of concat or define the number of character the first string
>> can occupy?
>> 
> 
> Can't you use something like:
> 
>    (format "%-40s" (concat ...))
> 
> ?
> 
> --
> Nick

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-14 13:02 Several %(expression) in org-agenda-prefix-format laurent.jucquois
  2016-04-14 21:12 ` Adam Porter
  2016-04-14 22:37 ` Christophe Schockaert
@ 2016-04-15 16:00 ` Ken Mankoff
  2016-04-15 17:49   ` laurent.jucquois
  2016-04-15 19:55   ` Peter Davis
  2 siblings, 2 replies; 12+ messages in thread
From: Ken Mankoff @ 2016-04-15 16:00 UTC (permalink / raw)
  To: laurent.jucquois; +Cc: org-mode-email


What about setting ":CATEGORY: PD v. BS" in the top level :PROPERTIES: drawer. Then in the agenda you'd see:

PD v BS:   My first pleadings

  -k.


On 2016-04-14 at 09:02, laurent.jucquois@posteo.de wrote:
> Hi list,
>
> I'm trying to setup some custom agenda views that would be useful for my 
> work but i'm unable to define a custom org-agenda-prefix-format with 
> several %expression successfully.
>
> My org-file is as follow:
>
> * Pierre Dupond v. Belgian State
> :PROPERTIES:
> :Case: Dupond
> :Location: Court of XX
> :FiscalYear: 13-14
> :CaseNum: 15/RG/139
> :END:
>
> ** My first pleadings
> DEADLINE: <2016-05-15 mon.>
> ** Pleading from Belgian State
> ** My second pleadings
> ** etc.
>
> When I check my agenda, it doesn't serve me at all to see the general 
> description "** My first pleadings" if I don't know to which case it 
> relates.
>
> So, I'm trying to setup a custom agenda view that would look like this:
>
> Dupond 15/RG/139 (13-14) : My first pleadings
>
> I've come up with the following (mal-functionning) 
> org-agenda-prefix-format:
>
> %(org-get-entry (point) "Case" t) %(org-entry-get (point) "CaseNum" t) 
> %(org-entry-get (point) "FiscalYear" t)
>
> But this only gives me :
>
> Dupond : My first pleadings
>
> I would really appreciate that someone points me into the right 
> direction.
>
> Thanks,
>
> Laurent

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-15 16:00 ` Ken Mankoff
@ 2016-04-15 17:49   ` laurent.jucquois
  2016-04-15 19:55   ` Peter Davis
  1 sibling, 0 replies; 12+ messages in thread
From: laurent.jucquois @ 2016-04-15 17:49 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: org-mode-email

> What about setting ":CATEGORY: PD v. BS" in the top level :PROPERTIES:
> drawer. Then in the agenda you'd see:
> 
> PD v BS:   My first pleadings
> 
>   -k.

Hi Ken,

That would've done it but a "Case" can have different deadlines for each 
"FiscalYear" so I actually need more info than just "Case".

Cheers,

Laurent

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-15 16:00 ` Ken Mankoff
  2016-04-15 17:49   ` laurent.jucquois
@ 2016-04-15 19:55   ` Peter Davis
  2016-04-15 21:47     ` Adam Porter
  1 sibling, 1 reply; 12+ messages in thread
From: Peter Davis @ 2016-04-15 19:55 UTC (permalink / raw)
  To: emacs-orgmode



On 4/15/16 12:00 PM, Ken Mankoff wrote:
> What about setting ":CATEGORY: PD v. BS" in the top level :PROPERTIES: drawer. Then in the agenda you'd see:
>
> PD v BS:   My first pleadings
>

Speaking as PD here, I want to state that I have long been opposed to BS.

-pd

-- 
----
Peter Davis
http://www.techcurmudgeon.com

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

* Re: Several %(expression) in org-agenda-prefix-format
  2016-04-15 19:55   ` Peter Davis
@ 2016-04-15 21:47     ` Adam Porter
  0 siblings, 0 replies; 12+ messages in thread
From: Adam Porter @ 2016-04-15 21:47 UTC (permalink / raw)
  To: emacs-orgmode

Thanks for the LOL.  :D

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

end of thread, other threads:[~2016-04-15 21:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-14 13:02 Several %(expression) in org-agenda-prefix-format laurent.jucquois
2016-04-14 21:12 ` Adam Porter
2016-04-15  8:16   ` laurent.jucquois
2016-04-14 22:37 ` Christophe Schockaert
2016-04-15  8:10   ` laurent.jucquois
2016-04-15 14:44     ` Nick Dokos
2016-04-15 15:52       ` Christophe Schockaert
2016-04-15 15:56       ` laurent.jucquois
2016-04-15 16:00 ` Ken Mankoff
2016-04-15 17:49   ` laurent.jucquois
2016-04-15 19:55   ` Peter Davis
2016-04-15 21:47     ` Adam Porter

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