emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* No completion when querying for property value in capture template
@ 2018-06-07 13:05 Eric Danan
  2018-06-07 15:21 ` Jeremie Juste
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Danan @ 2018-06-07 13:05 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

Hello,

There seems to be an old thread about this but I didn't find an answer
there:

http://lists.gnu.org/archive/html/emacs-orgmode/2011-10/msg01079.html

If, from an org file containing two entries with respective values "foobar"
and "foobaz" for property "prop", I call "org-set-property" to set property
"prop", then the two values "foobar" and "foobaz" are offered as
completions.

But if I define a capture template with that file as target and the element
"%^{prop}p" in the template, then no completetion is offered when I am
queried for the property value. That makes this template element much less
usable in my opinion. Is it a bug?

I tested with "emacs -q"
GNU Emacs 26.1 (build 1, x86_64-unknown-cygwin) of 2018-05-28
Org mode version 9.1.13 (9.1.13-elpaplus @
/c/test/.emacs.d/elpa/org-plus-contrib-20180604/)

I'm happy to help with further testing if needed.

Thanks in advance,

Eric

[-- Attachment #2: Type: text/html, Size: 1359 bytes --]

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

* Re: No completion when querying for property value in capture template
  2018-06-07 13:05 No completion when querying for property value in capture template Eric Danan
@ 2018-06-07 15:21 ` Jeremie Juste
  2018-06-07 21:18   ` Eric Danan
  0 siblings, 1 reply; 8+ messages in thread
From: Jeremie Juste @ 2018-06-07 15:21 UTC (permalink / raw)
  To: Eric Danan; +Cc: emacs-orgmode

Hello,

As far as I know it is not currently possible to get property
auto-completion from the property list of the file itself.

but you could still make use of the stock property in the template and auto-complete
from there

For instance:

("T" "TEST" entry (file+headline"/tmp/test.org" "drill")
	"** TEST  \n :PROPERTIES:\n :Effort: %^{prompt|0:10|0:20|0:30|1:00|2:00|3:00}\n :END: \n %^{PROMPT} " )

see the rest of the thread for more details http://lists.gnu.org/archive/html/emacs-orgmode/2011-10/msg01339.html



Would  there be a way to for the capture template to read this info in the future? For
instance to read the column format for the entire file like
#+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO


HTH,

Jeremie

Eric Danan <eric.danan@u-cergy.fr> writes:

> Hello,
>
> There seems to be an old thread about this but I didn't find an answer
> there:
>
> http://lists.gnu.org/archive/html/emacs-orgmode/2011-10/msg01079.html
>
> If, from an org file containing two entries with respective values
> "foobar" and "foobaz" for property "prop", I call "org-set-property" to
> set property "prop", then the two values "foobar" and "foobaz" are
> offered as completions.
>
> But if I define a capture template with that file as target and the
> element "%^{prop}p" in the template, then no completetion is offered when
> I am queried for the property value. That makes this template element
> much less usable in my opinion. Is it a bug?
>
> I tested with "emacs -q"
> GNU Emacs 26.1 (build 1, x86_64-unknown-cygwin) of 2018-05-28
> Org mode version 9.1.13 (9.1.13-elpaplus @ /c/test/.emacs.d/elpa/
> org-plus-contrib-20180604/)
>
> I'm happy to help with further testing if needed.
>
> Thanks in advance,
>
> Eric

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

* Re: No completion when querying for property value in capture template
  2018-06-07 15:21 ` Jeremie Juste
@ 2018-06-07 21:18   ` Eric Danan
  2018-06-08 20:29     ` [PATCH] " Eric Danan
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Danan @ 2018-06-07 21:18 UTC (permalink / raw)
  To: Jérémie Juste; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

Thanks.

As far as I know it is not currently possible to get property
> auto-completion from the property list of the file itself.
>

I don't understand: when I call "org-set-property" directly from the file
(C-c C-x p), it does get all the property values in the file and proposes
them for completion. I am probably missing your pint, could I ask you to
explain?

Only when I use the "%^{prop}p" capture template element are the values not
offered. I don't understand why because looking at the code of
"org-capture-fill-template", it seems to simply call "org-set-property" for
this element.

but you could still make use of the stock property in the template and
> auto-complete
> from there
>
> For instance:
>
> ("T" "TEST" entry (file+headline"/tmp/test.org" "drill")
>         "** TEST  \n :PROPERTIES:\n :Effort:
> %^{prompt|0:10|0:20|0:30|1:00|2:00|3:00}\n :END: \n %^{PROMPT} " )
>
> see the rest of the thread for more details
> http://lists.gnu.org/archive/html/emacs-orgmode/2011-10/msg01339.html
>

Yes I've read the rest of the thread, but that's not always feasible. In my
use case, the property values are titles of academic journals, I can't list
them all inside a "%^{prompt}" template element, I need them to be fetched
from the file.

Thanks again.

Eric

[-- Attachment #2: Type: text/html, Size: 2055 bytes --]

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

* Re: [PATCH] No completion when querying for property value in capture template
  2018-06-07 21:18   ` Eric Danan
@ 2018-06-08 20:29     ` Eric Danan
  2018-06-16 15:06       ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Danan @ 2018-06-08 20:29 UTC (permalink / raw)
  To: Jérémie Juste; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

OK I think I understand why it doesn't work. I'm attaching a simple
patch that hopefully solves the issue. I've put comments in the commit
message. Please let me know if anything is not clear or if you see
issues.

Eric

On Thu, Jun 7, 2018 at 11:18 PM Eric Danan <eric.danan@u-cergy.fr> wrote:
>
> Thanks.
>
>> As far as I know it is not currently possible to get property
>> auto-completion from the property list of the file itself.
>
>
> I don't understand: when I call "org-set-property" directly from the file (C-c C-x p), it does get all the property values in the file and proposes them for completion. I am probably missing your pint, could I ask you to explain?
>
> Only when I use the "%^{prop}p" capture template element are the values not offered. I don't understand why because looking at the code of "org-capture-fill-template", it seems to simply call "org-set-property" for this element.
>
>> but you could still make use of the stock property in the template and auto-complete
>> from there
>>
>> For instance:
>>
>> ("T" "TEST" entry (file+headline"/tmp/test.org" "drill")
>>         "** TEST  \n :PROPERTIES:\n :Effort: %^{prompt|0:10|0:20|0:30|1:00|2:00|3:00}\n :END: \n %^{PROMPT} " )
>>
>> see the rest of the thread for more details http://lists.gnu.org/archive/html/emacs-orgmode/2011-10/msg01339.html
>
>
> Yes I've read the rest of the thread, but that's not always feasible. In my use case, the property values are titles of academic journals, I can't list them all inside a "%^{prompt}" template element, I need them to be fetched from the file.
>
> Thanks again.
>
> Eric

[-- Attachment #2: 0001-org-capture.el-Offer-property-value-completions-in-c.patch --]
[-- Type: application/x-patch, Size: 2331 bytes --]

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

* Re: [PATCH] No completion when querying for property value in capture template
  2018-06-08 20:29     ` [PATCH] " Eric Danan
@ 2018-06-16 15:06       ` Nicolas Goaziou
  2018-06-16 19:59         ` Eric Danan
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2018-06-16 15:06 UTC (permalink / raw)
  To: Eric Danan; +Cc: emacs-orgmode

Hello,

Eric Danan <eric.danan@u-cergy.fr> writes:

> OK I think I understand why it doesn't work. I'm attaching a simple
> patch that hopefully solves the issue. I've put comments in the commit
> message. Please let me know if anything is not clear or if you see
> issues.

Thank you for the analysis and the patch. As you have guessed, the
problem is that the property is set in a different buffer than the
target buffer.

I committed a different solution. Does it fix your problem?

Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] No completion when querying for property value in capture template
  2018-06-16 15:06       ` Nicolas Goaziou
@ 2018-06-16 19:59         ` Eric Danan
  2018-06-16 21:24           ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Danan @ 2018-06-16 19:59 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode

Thanks.

I did some testing and it seems towork except in one case: if the
template target is of type "file+headline" (I guess "file+olp" etc as
well), the target file has an in-buffer setting "#+PROPERTY PROP_ALL
AAA BBB", and the target entry has a property ":PROP_ALL:  CCC DDD"
overriding the in-buffer setting, then completion is done on "AAA BBB"
whereas it would make more sense to me to do it on "CCC DDD".

It is perhaps not a major issue, but could be a convenient way to
specify different sets of allowed values for different target entries
in the same file (it already works, however, if the target file has no
in-buffer setting for the allowed values). An alternative could be to
allow patterns of the form "%^{prop|allowed1|allowed2|...}p" in the
capture template (that would in fact be even more flexible because it
would allow to specify different sets of allowed values for different
capture templates with the same target entry).

Eric
On Sat, Jun 16, 2018 at 5:06 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> Hello,
>
> Eric Danan <eric.danan@u-cergy.fr> writes:
>
> > OK I think I understand why it doesn't work. I'm attaching a simple
> > patch that hopefully solves the issue. I've put comments in the commit
> > message. Please let me know if anything is not clear or if you see
> > issues.
>
> Thank you for the analysis and the patch. As you have guessed, the
> problem is that the property is set in a different buffer than the
> target buffer.
>
> I committed a different solution. Does it fix your problem?
>
> Regards,
>
> --
> Nicolas Goaziou

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

* Re: [PATCH] No completion when querying for property value in capture template
  2018-06-16 19:59         ` Eric Danan
@ 2018-06-16 21:24           ` Nicolas Goaziou
  2018-06-17  9:33             ` Eric Danan
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2018-06-16 21:24 UTC (permalink / raw)
  To: Eric Danan; +Cc: emacs-orgmode

Eric Danan <eric.danan@u-cergy.fr> writes:

> I did some testing and it seems towork except in one case: if the
> template target is of type "file+headline" (I guess "file+olp" etc as
> well), the target file has an in-buffer setting "#+PROPERTY PROP_ALL
> AAA BBB", and the target entry has a property ":PROP_ALL:  CCC DDD"
> overriding the in-buffer setting, then completion is done on "AAA BBB"
> whereas it would make more sense to me to do it on "CCC DDD".

I think this is now fixed. Thank you.

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

* Re: [PATCH] No completion when querying for property value in capture template
  2018-06-16 21:24           ` Nicolas Goaziou
@ 2018-06-17  9:33             ` Eric Danan
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Danan @ 2018-06-17  9:33 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode

Indeed it works now, thanks!
On Sat, Jun 16, 2018 at 11:24 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> Eric Danan <eric.danan@u-cergy.fr> writes:
>
> > I did some testing and it seems towork except in one case: if the
> > template target is of type "file+headline" (I guess "file+olp" etc as
> > well), the target file has an in-buffer setting "#+PROPERTY PROP_ALL
> > AAA BBB", and the target entry has a property ":PROP_ALL:  CCC DDD"
> > overriding the in-buffer setting, then completion is done on "AAA BBB"
> > whereas it would make more sense to me to do it on "CCC DDD".
>
> I think this is now fixed. Thank you.

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

end of thread, other threads:[~2018-06-17  9:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-07 13:05 No completion when querying for property value in capture template Eric Danan
2018-06-07 15:21 ` Jeremie Juste
2018-06-07 21:18   ` Eric Danan
2018-06-08 20:29     ` [PATCH] " Eric Danan
2018-06-16 15:06       ` Nicolas Goaziou
2018-06-16 19:59         ` Eric Danan
2018-06-16 21:24           ` Nicolas Goaziou
2018-06-17  9:33             ` Eric Danan

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