No. org-set-property
does exactly what the documentation says: it only prompts for a value if no value is specified as an argument. Because it says nothing about specifying a default value for that prompt, there is no default value for that prompt.
However, you could modify it fairly easily to support your use–case. If you look in org.el, you will find how it deals with the value argument:
(let ((value (or value (org-read-property-value property)))
…)
…)
As you can see, if value
is nil
then it calls org-read-property-value
. If you look at the documentation for org-read-property-value
, you will see that it does take an extra argument that specifies the default value for the input:
(org-read-property-value PROPERTY &optional POM DEFAULT)
Documentation
Read value for PROPERTY, as a string.
When optional argument POM is non-nil, completion uses additional
information, i.e., allowed or existing values at point or marker
POM.
Optional argument DEFAULT provides a default value for PROPERTY.
So you could change the argument list of org-set-property
to (property value &optional default-value)
, then pass that information along like this:
(let ((value (or value (org-read-property-value property nil default-value)))
…)
…)
Note that you don’t actually need to modify org.el; you can instead use advice to override the definition of this function. See chapter 13.11 Advising Emacs Lisp Functions for more information about how to do this.
Edit:
Oh, and as a commenter mentioned, you don’t need a quote '
in front of a lambda
expression. Write your keybinding like this instead:
(map! :desc "Set ID property" "lI"
(lambda ()
(interactive)
(org-set-property "ID")))
Of course, that has nothing to do with your question. It’s just that the quote prevents the Elisp compiler from optimizing your code. It is unlikely that you would notice a performance different though.