[Top][All Lists]

[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: Wed, 08 Jul 2020 12:07:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Kyle Meyer <kyle@kyleam.com> writes:

> Nick Dokos writes:
>> Here's the amended patch: it includes the fixes from Kyle's review, the 
>> modification
>> he suggested that adds the plain property for each _ALL property to the list
>> and a few test cases to the test/org-buffer-property-keys test.
> Thank you for the updates.  Applied (bc4fa8a00).
>> -            nil)))
>> +            ;; Get property names from #+PROPERTY keywords as well
>> +            (mapcar (lambda (s)
>> +                      (nth 0 (split-string s)))
>> +                    (cdar (org-collect-keywords '("PROPERTY"))))
>> +            nil))
> I didn't spot it earlier, but this nil (not added by your patch) is
> unnecessary.  Since the patch is touching the line anyway, I've dropped
> it on apply.
>> +    bare-props)
>>      (org-with-wide-buffer
>>       (goto-char (point-min))
>>       (while (re-search-forward org-property-start-re nil t)
>> @@ -13132,7 +13137,15 @@ COLUMN formats in the current buffer."
>>               (let ((p (match-string-no-properties 1 value)))
>>                 (unless (member-ignore-case p org-special-properties)
>>                   (push p props))))))))))
>> -    (sort (delete-dups props) (lambda (a b) (string< (upcase a) (upcase 
>> b))))))
>> +    (sort (delete-dups (append props
>> +                           ;; for each xxx_ALL property, make sure
>> +                           ;; the bare xxx property is also
>> +                           ;; included
>> +                           (dolist (x props bare-props)
>> +                             (if (string-match "_ALL\\b" x)
>> +                                 (setq bare-props (cons (substring x 0 -4)
>> +                                                        bare-props))))))
> I did a cosmetic rewrite here to use mapcar, which I hope you won't
> mind.

BTW, I just thought of a possible problem: the manual says that property
keys are case-insensitive (although all the examples I can find spell
"_ALL" in upper case, but if I write

  :foo_all: bar baz

I don't think that the code is going to handle it correctly. There
are other places that also use "_ALL" without a let of case-fold-search
(at least AFAICT).

Am I paranoid or is this a problem?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]