org-read-property-value: Fix DEFAULT arg when values are not restricted

* lisp/org.el (org-read-property-value): Honor DEFAULT argument when
property can have arbitrary value.

Reported-by: Janek F <xerusx@pm.me>
Link: https://orgmode.org/list/hh0ohv2LgPq86aW2Kp4AFV1VZ3yLuZafFLFqWN_NCciQcy86rxDkcZryr7gyPXrNzjFdP8lhdC0GS4c_XQtVXjOKDD-lqkJjlswSGX7OWvo=@pm.me
This commit is contained in:
Ihor Radchenko 2023-02-03 14:42:35 +03:00
parent 562cba7aab
commit 0522c1850b
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 6 additions and 2 deletions

View File

@ -13183,7 +13183,11 @@ Optional argument DEFAULT provides a default value for PROPERTY."
(if (org-string-nw-p current)
(format " [%s]" current)
"")))
(set-function (org-set-property-function property)))
(set-function (org-set-property-function property))
(default (cond
((not allowed) default)
((member default allowed) default)
(t nil))))
(org-trim
(if allowed
(funcall set-function
@ -13195,7 +13199,7 @@ Optional argument DEFAULT provides a default value for PROPERTY."
(and pom
(org-with-point-at pom
(org-property-values property)))))))
(funcall set-function prompt all nil nil "" nil current))))))
(funcall set-function prompt all nil nil default nil current))))))
(defvar org-last-set-property nil)
(defvar org-last-set-property-value nil)