* 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; 6+ messages in thread From: Janek F @ 2022-09-16 18:08 UTC (permalink / raw) To: emacs-orgmode@gnu.org 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] 6+ 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 2023-02-02 6:44 ` Janek F 0 siblings, 1 reply; 6+ messages in thread From: Ihor Radchenko @ 2022-09-20 8:11 UTC (permalink / raw) To: Janek F; +Cc: emacs-orgmode@gnu.org 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] 6+ messages in thread
* Re: Properly handle defaults in org-set-property 2022-09-20 8:11 ` Ihor Radchenko @ 2023-02-02 6:44 ` Janek F 2023-02-02 11:14 ` Ihor Radchenko 0 siblings, 1 reply; 6+ messages in thread From: Janek F @ 2023-02-02 6:44 UTC (permalink / raw) To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org That is exactly what I use, as you can see in my dotfiles: https://code.ftt.gmbh/janek/dotfiles/src/branch/main/.config/doom/config.el#L293 But it leads to the exact aforementioned problem... ------- Original Message ------- Ihor Radchenko <yantar92@gmail.com> schrieb am Dienstag, 20. September 2022 um 10:10: > 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] 6+ messages in thread
* Re: Properly handle defaults in org-set-property 2023-02-02 6:44 ` Janek F @ 2023-02-02 11:14 ` Ihor Radchenko 2023-02-02 17:21 ` Janek F 0 siblings, 1 reply; 6+ messages in thread From: Ihor Radchenko @ 2023-02-02 11:14 UTC (permalink / raw) To: Janek F; +Cc: Ihor Radchenko, emacs-orgmode@gnu.org Janek F <xerusx@pm.me> writes: > That is exactly what I use, as you can see in my dotfiles: > https://code.ftt.gmbh/janek/dotfiles/src/branch/main/.config/doom/config.el#L293 > > But it leads to the exact aforementioned problem... May you please elaborate? What exactly did you do? What did you expect to happen? What actually happened? (See https://orgmode.org/manual/Feedback.html#Feedback) -- Ihor Radchenko // yantar92, 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] 6+ messages in thread
* Re: Properly handle defaults in org-set-property 2023-02-02 11:14 ` Ihor Radchenko @ 2023-02-02 17:21 ` Janek F 2023-02-03 11:45 ` Ihor Radchenko 0 siblings, 1 reply; 6+ messages in thread From: Janek F @ 2023-02-02 17:21 UTC (permalink / raw) To: Ihor Radchenko; +Cc: Ihor Radchenko, emacs-orgmode@gnu.org 1. Put the cursor on a heading that does not have an id 2. Invoke (org-set-property "ID" (org-read-property-value "ID" nil "default-value")) via keybind or Alt-: 3. default-value is not within the list of suggestions ~ Janek ------- Original Message ------- Ihor Radchenko <yantar92@posteo.net> schrieb am Donnerstag, 2. Februar 2023 um 12:14: > Janek F xerusx@pm.me writes: > > > That is exactly what I use, as you can see in my dotfiles: > > https://code.ftt.gmbh/janek/dotfiles/src/branch/main/.config/doom/config.el#L293 > > > > But it leads to the exact aforementioned problem... > > > May you please elaborate? What exactly did you do? What did you expect > to happen? What actually happened? (See > https://orgmode.org/manual/Feedback.html#Feedback) > > > -- > Ihor Radchenko // yantar92, > 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] 6+ messages in thread
* Re: Properly handle defaults in org-set-property 2023-02-02 17:21 ` Janek F @ 2023-02-03 11:45 ` Ihor Radchenko 0 siblings, 0 replies; 6+ messages in thread From: Ihor Radchenko @ 2023-02-03 11:45 UTC (permalink / raw) To: Janek F; +Cc: Ihor Radchenko, emacs-orgmode@gnu.org Janek F <xerusx@pm.me> writes: > 1. Put the cursor on a heading that does not have an id > 2. Invoke (org-set-property "ID" (org-read-property-value "ID" nil "default-value")) via keybind or Alt-: > 3. default-value is not within the list of suggestions Fixed, on main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0522c1850 -- Ihor Radchenko // yantar92, 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] 6+ messages in thread
end of thread, other threads:[~2023-02-03 11:45 UTC | newest] Thread overview: 6+ 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 2023-02-02 6:44 ` Janek F 2023-02-02 11:14 ` Ihor Radchenko 2023-02-02 17:21 ` Janek F 2023-02-03 11:45 ` 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).