From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christophe Schockaert Subject: Re: %? has no effect for org-agenda-prefix-format Date: Wed, 16 Mar 2016 23:43:21 +0100 Message-ID: <8737rqdoxi.fsf@artlab.createcnix.lan> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agKAE-00059O-QN for emacs-orgmode@gnu.org; Wed, 16 Mar 2016 18:43:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agKA9-0001UJ-Pj for emacs-orgmode@gnu.org; Wed, 16 Mar 2016 18:43:38 -0400 Received: from smtp2.tech.numericable.fr ([82.216.111.38]:35482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agKA9-0001U2-K5 for emacs-orgmode@gnu.org; Wed, 16 Mar 2016 18:43:33 -0400 In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Markus Heller Cc: emacs-orgmode@gnu.org 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: > > > ((org-agenda-prefix-format " %-5c %?-4(setq type (org-entry-get (point) > \"Type\")): ") > 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] <---------------<<<<