org-sparse-tree: Fix matching property names containing "-"

* lisp/org.el (org-sparse-tree): Escape "-" in property names.

Reported-by: Fabian Kurmann <fabian.kurmann@uni-duesseldorf.de>
Link: https://orgmode.org/list/87v87qprwq.fsf@localhost
This commit is contained in:
Ihor Radchenko 2024-03-19 17:00:52 +03:00
parent 46909a54e1
commit 63b10621a0
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 0 deletions

View File

@ -10922,6 +10922,9 @@ D Show deadlines and scheduled items between a date range."
((?p ?P) ((?p ?P)
(let* ((kwd (completing-read (let* ((kwd (completing-read
"Property: " (mapcar #'list (org-buffer-property-keys)))) "Property: " (mapcar #'list (org-buffer-property-keys))))
(kwd
;; Escape "-" in property names.
(replace-regexp-in-string "-" "\\\\-" kwd))
(value (completing-read (value (completing-read
"Value: " (mapcar #'list (org-property-values kwd))))) "Value: " (mapcar #'list (org-property-values kwd)))))
(unless (string-match "\\`{.*}\\'" value) (unless (string-match "\\`{.*}\\'" value)