emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Properly handle defaults in org-set-property
@ 2022-09-16 18:08 Janek F
  2022-09-20  8:11 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Janek F @ 2022-09-16 18:08 UTC (permalink / raw)
  To: emacs-orgmode

As discussed in https://emacs.stackexchange.com/questions/71774/pass-default-value-to-org-set-property/71777, providing a default to org-set-property does not always work.

It calls `org-read-property-value`, which only uses the supplied default value if it can compute a list of allowed values for the property. But then, the default value has to be part of that `_ALL` list.

Can this be changed so it always uses the given default?


Thanks everyone for the great work!
~ Janek


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Properly handle defaults in org-set-property
  2022-09-16 18:08 Properly handle defaults in org-set-property Janek F
@ 2022-09-20  8:11 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-09-20  8:11 UTC (permalink / raw)
  To: Janek F; +Cc: emacs-orgmode

Janek F <xerusx@pm.me> writes:

> As discussed in https://emacs.stackexchange.com/questions/71774/pass-default-value-to-org-set-property/71777, providing a default to org-set-property does not always work.
>
> It calls `org-read-property-value`, which only uses the supplied default value if it can compute a list of allowed values for the property. But then, the default value has to be part of that `_ALL` list.
>
> Can this be changed so it always uses the given default?

Why don't you just use

(map! :desc "Set ID property" "lI"
      '(lambda ()
         (interactive)
         (org-set-property "ID" (org-read-property-value "ID" nil "default-value"))))

?

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-20  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 18:08 Properly handle defaults in org-set-property Janek F
2022-09-20  8:11 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).