* %? has no effect for org-agenda-prefix-format
@ 2016-03-16 21:58 Markus Heller
2016-03-16 22:43 ` Christophe Schockaert
0 siblings, 1 reply; 2+ messages in thread
From: Markus Heller @ 2016-03-16 21:58 UTC (permalink / raw)
To: emacs-orgmode
Excerpt from describe-variable org-agenda-prefix-format:
If the first character after `%' is a question mark, the entire field
will only be included if the corresponding value applies to the current
entry. This is useful for fields which should have fixed width when
present, but zero width when absent. For example, "%?-12t" will
result in a 12 character time field if a time of the day is specified,
but will completely disappear in entries which do not contain a time.
This does not work for me (emacs 24.3, Org-mode version 8.2.10 (8.2.10-
41-g42228a-elpa)).
Excerpt from agenda view:
<excerpt agenda view>
Project Subtasks
INFRA nil : TODO Purchase Fragment Library
</excerpt agenda view>
Excerpt from org file (Not that the task in question has no Property
drawer at all):
<excerpt org file>
* Other Infrastructure Development
:PROPERTIES:
:CATEGORY: INFRA
:END:
** TODO NMR-based Fragment Screen
*** TODO Purchase Fragment Library
</excerpt org file>
Here's the definition of org-agenda-prefix-format from my .emacs:
<excerpt from .emacs>
((org-agenda-prefix-format " %-5c %?-4(setq type (org-entry-get (point)
\"Type\")): ")
</excerpt from .emacs>
There is a similar thread on stackexchange from March 10 on this
(http://stackoverflow.com/questions/35910204/org-agenda-prefix-format-
does-not-work).
Is this a bug?
Thanks
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: %? has no effect for org-agenda-prefix-format
2016-03-16 21:58 %? has no effect for org-agenda-prefix-format Markus Heller
@ 2016-03-16 22:43 ` Christophe Schockaert
0 siblings, 0 replies; 2+ messages in thread
From: Christophe Schockaert @ 2016-03-16 22:43 UTC (permalink / raw)
To: Markus Heller; +Cc: emacs-orgmode
Markus Heller writes:
> Excerpt from describe-variable org-agenda-prefix-format:
>
> If the first character after `%' is a question mark, the entire field
> will only be included if the corresponding value applies to the current
> entry. [...]
>
> [...]
> Here's the definition of org-agenda-prefix-format from my .emacs:
>
> <excerpt from .emacs>
> ((org-agenda-prefix-format " %-5c %?-4(setq type (org-entry-get (point)
> \"Type\")): ")
> </excerpt from .emacs>
Hi Markus,
Glad I could feed you with the trick you expected !
As for the "?" modifier, I wonder if I didn't stumble on that too.
However, we can achieve the functionnality we want in this field, since
we have free lisp there.
I used an "if" to return "" when the property is not defined, resulting in
a 0 width output, so I get the same behaviour as the "?".
Then, if you need formatting, I don't remember if the width formating is
taken into account. In any case, I think you could obtain that result
with string formatting inside the "%(expression)" itself
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Formatting-Strings.html).
Format width aside, I guess the behavior for the "?" would not be easy
to define: as the content built within "%(expr)" is free, how can we define "the
corresponding value applies to the current entry" ?
It would be nice if it was explained in the docstring however.
Cheerfully,
Christophe
> There is a similar thread on stackexchange from March 10 on this
> (http://stackoverflow.com/questions/35910204/org-agenda-prefix-format-
> does-not-work).
>
> Is this a bug?
>
> Thanks
> Markus
--
---------------> 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] 2+ messages in thread
end of thread, other threads:[~2016-03-16 22:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16 21:58 %? has no effect for org-agenda-prefix-format Markus Heller
2016-03-16 22:43 ` Christophe Schockaert
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).