[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] org: add property names from #+PROPERTY keywords to completi
From: |
Nick Dokos |
Subject: |
Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list |
Date: |
Tue, 07 Jul 2020 08:44:34 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi Kyle,
thanks for the review.
Kyle Meyer <kyle@kyleam.com> writes:
> Nick Dokos writes:
>
>> Here's a patch to enhance the property name completion list with names from
>> #+PROPERTY keyword lines: at the moment, only property names found in
>> property
>> drawers are used to populate the completion list.
>
> Thanks for the patch.
>
>> org: add property names from #+PROPERTY keywords to completion list
>>
>> * lisp/org.el (org-buffer-property-keys): ehhance the completion list
>
> Typo: enhance. And as a convention nit, it should be capitalized.
>
Fixed.
>> with property names from #+PROPERTY keywords, not just property
>> drawers.
>>
>> ...
>> + (mapcar (lambda (s)
>> + (let ((split (split-string s)))
>> + (nth 0 split)))
>> + (cdar (org-collect-keywords '("PROPERTY"))))
>> nil)))
>
> IMO the let-binding doesn't add any clarity over
>
> (nth 0 (split-string s))
>
Fixed.
>
> I wondered about possible duplicates, but it looks like
> org-buffer-property-keys already takes care of that at the end.
>
> I think this patch is a clear improvement as is, but in the context of
> completion (and the stack exchange post you link to), isn't the handling
> around *_ALL keywords still a bit off? It seems a caller would want to
> complete without the _ALL; to use the example from that post, with
> "#+PROPERTY: GENRE_ALL ...", the caller would want to complete "GENRE".
> Is it worth providing special handling here?
>
>
My assumption was that one could put in two properties (that's what
the OP was doing in his setup file): a GENRE_ALL one already properly
set-up and the corresponding bare GENRE property as a placeholder with
an empty value, just to get the completion. It seems to me like a
reasonable way to do it, without making org-buffer-property-keys too
opinionated.
I could see stripping all the _ALL suffixes from the property names
at the end, but personally it just makes me a bit queasy :) But if
there is consensus one way or the other, I'd be happy to implement it.
Here's the updated patch:
--8<---------------cut here---------------start------------->8---
>From 50c625f935d5581952d37801943550ff44c473ff Mon Sep 17 00:00:00 2001
From: Nick Dokos <ndokos@redhat.com>
Date: Mon, 6 Jul 2020 21:49:41 -0400
Subject: [PATCH] org: add property names from #+PROPERTY keywords to
completion list
* lisp/org.el (org-buffer-property-keys): Enhance the completion list
with property names from #+PROPERTY keywords, not just property
drawers.
See https://emacs.stackexchange.com/questions/59448/ for details.
---
lisp/org.el | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lisp/org.el b/lisp/org.el
index 4a1a83d0f..8deaa1ed9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13084,6 +13084,10 @@ COLUMN formats in the current buffer."
(props (append
(and specials org-special-properties)
(and defaults (cons org-effort-property org-default-properties))
+ ;; Get property names from #+PROPERTY keywords as well
+ (mapcar (lambda (s)
+ (nth 0 (split-string s)))
+ (cdar (org-collect-keywords '("PROPERTY"))))
nil)))
(org-with-wide-buffer
(goto-char (point-min))
--
2.25.1
--8<---------------cut here---------------end--------------->8---
--
Nick
"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler
- [PATCH] org: add property names from #+PROPERTY keywords to completion list, Nick Dokos, 2020/07/06
- Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list, Nick Dokos, 2020/07/06
- Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list, Kyle Meyer, 2020/07/07
- Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list,
Nick Dokos <=
- Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list, Nick Dokos, 2020/07/07
- Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list, Nick Dokos, 2020/07/07
- Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list, Kyle Meyer, 2020/07/07
- Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list, Nick Dokos, 2020/07/08
- Re: [PATCH] org: add property names from #+PROPERTY keywords to completion list, Nick Dokos, 2020/07/08
- [PATCH] agenda: Fold case when retrieving user-configured effort values, Kyle Meyer, 2020/07/09
- Re: [PATCH] agenda: Fold case when retrieving user-configured effort values, Nick Dokos, 2020/07/09