Function: org-read-property-value

org-read-property-value is a byte-compiled function defined in org.el.gz.

Signature

(org-read-property-value PROPERTY &optional EPOM DEFAULT)

Documentation

Read value for PROPERTY, as a string.

When optional argument EPOM is non-nil, completion uses additional information, i.e., allowed or existing values at element, point, or marker EPOM. Optional argument DEFAULT provides a default value for PROPERTY.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-read-property-value (property &optional epom default)
  "Read value for PROPERTY, as a string.
When optional argument EPOM is non-nil, completion uses additional
information, i.e., allowed or existing values at element, point, or
marker EPOM.
Optional argument DEFAULT provides a default value for PROPERTY."
  (let* ((completion-ignore-case t)
	 (allowed
	  (or (org-property-get-allowed-values nil property 'table)
	      (and epom (org-property-get-allowed-values epom property 'table))))
	 (current (org-entry-get nil property))
	 (prompt (format "%s value%s: "
			 property
			 (if (org-string-nw-p current)
			     (format " [%s]" current)
			   "")))
	 (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
		  prompt allowed nil
		  (not (get-text-property 0 'org-unrestricted (caar allowed)))
		  default nil default)
       (let ((all (mapcar #'list
			  (append (org-property-values property)
				  (and epom
				       (org-with-point-at epom
					 (org-property-values property)))))))
	 (funcall set-function prompt all nil nil default nil current))))))