[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: org-set-properties for various (all) headings
From: |
Uwe Brauer |
Subject: |
Re: org-set-properties for various (all) headings |
Date: |
Tue, 19 Jul 2022 16:53:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>>> "KM" == Kaushal Modi <kaushal.modi@gmail.com> writes:
> Check out org-map-entries. I have one example here:
> https://scripter.co/looping-through-org-mode-headings/#example-modifying-a-property-in-all-headings
> .
Very nice thanks however one question.
I started as test with
#+begin_src
** TODO Test
:PROPERTIES:
:Sent: [ ]
:END:
** WAIT Test2
:PROPERTIES:
:Sent: [ ]
:END:
** TODO Test3
:PROPERTIES:
:Sent: [ ]
:END:
#+end_src
I then used the code:
#+begin_src elisp :noexport
(defun test/set-property-at-heading ()
"Function to be called at the beginning of an Org heading."
(interactive)
(let ((el (org-element-at-point)))
(org-set-property "foo" (org-element-property :title el))))
(org-map-entries #'test/set-property-at-heading)
#+end_src
And indeed ended up with
#+begin_src
#+COLUMNS: %TODO %40ITEM(Task) %40SUMMARY(Summary) %Received(Rec)
** TODO Test
:PROPERTIES:
:Sent: [ ]
:foo: Test
:END:
** WAIT Test2
:PROPERTIES:
:Sent: [ ]
:foo: Test2
:END:
** TODO Test3
:PROPERTIES:
:Sent: [ ]
:foo: Test3
:END:
#+end_src
However I wanted to insert a checkbox not a title so I tried
#+begin_src
#+begin_src elisp :noexport
(defun my-set-property-at-heading ()
"Function to be called at the beginning of an Org heading."
(interactive)
(let ((el (org-element-at-point)))
(org-set-property "New" (org-element-property "[ ]" el)))))
(org-map-entries #'my-set-property-at-heading)
#+end_src
But this did not work, I am either asked all the time (but I have 200
headers), or it does not work at all. I also tried
#+begin_src elisp :noexport
(defun my-set-property-at-heading ()
"Function to be called at the beginning of an Org heading."
(interactive)
(let ((el (org-element-at-point)))
(org-set-property "New2" (org-element-property :checkbox el))))
(org-map-entries #'my-set-property-at-heading)
#+end_src
Thanks again
Uwe Brauer
smime.p7s
Description: S/MIME cryptographic signature
- org-set-properties for various (all) headings, Uwe Brauer, 2022/07/19
- Re: org-set-properties for various (all) headings, Kaushal Modi, 2022/07/19
- Re: org-set-properties for various (all) headings,
Uwe Brauer <=
- Re: org-set-properties for various (all) headings, Kaushal Modi, 2022/07/19
- Re: org-set-properties for various (all) headings, Uwe Brauer, 2022/07/19
- Re: org-set-properties for various (all) headings, Kaushal Modi, 2022/07/19
- Re: org-set-properties for various (all) headings, Uwe Brauer, 2022/07/20
- Re: org-set-properties for various (all) headings, Ihor Radchenko, 2022/07/20
- Re: org-set-properties for various (all) headings, Uwe Brauer, 2022/07/20
- Re: org-set-properties for various (all) headings, Kaushal Modi, 2022/07/20