[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: insert a header and automatically a timestamp with date/time
From: |
Pedro |
Subject: |
Re: insert a header and automatically a timestamp with date/time |
Date: |
Sat, 1 Feb 2025 22:04:41 +0100 |
On 2025-02-01 18:43, Uwe Brauer via
General discussions about Org-mode. wrote:
(BTW do you speak Spanish , since there is some Spanish text in the
files that are attached)
Anyhow.
Let me see if I understand that correctly
- Your code does not insert
* <2025-02-01>
But instead
* Some heading
:PROPERTIES:
:CREATED: [2023-11-17 Fri 19:32]
:END:
that is also ok, but for the moment I prefer the timestamp in the
heading, because if I use outline-hide-body I obtain a nice overview
with the dates.
- Another problem is that I don't get your code to work for example
the one in the file auto-insert-created-timestamp-as-property.org
gives me
Yes, I speak Spanish :)
To generate dates as you said, you can use the following code [0],
on ~man date~ you can find other strftime format constructions, or
alternatively, visit this [1]
The scheduled thing [2] had an if for certain conditions where you
want that hook to get triggered (that uses specific buffer names
that in my case are [2]), for a more simple approach, you might want
to experiment with a simpler function [3]
I attach again the script
migrate-from-ts-header-to-created-property.org because I got
confused; I hope "soon" I could have a git public repo with my emacs
config
[0]
#+begin_src emacs-lisp
(defun my/org-add-timestamp-on-heading ()
(save-excursion
(org-back-to-heading)
(org-edit-headline (format-time-string "<%F>"))
(my/set-property-with-inactive-timestamp "CREATED")))
(add-hook 'org-insert-heading-hook 'my/org-add-timestamp-on-heading
'append)
;; to remove it
;; (remove-hook 'org-insert-heading-hook
'my/org-add-timestamp-on-heading)
#+end_src
[1] https://strftime.org/
[2]
#+begin_src emacs-lisp
(setq my/diary-file "1activity.org")
(setq my/board-file "board.org")
(setq my/proj-file "projects.org")
(setq my/proj-candidates-file "projects-candidates.org")
#+end_src
[3]
#+begin_src emacs-lisp
(defun my/org-heading-insert-scheduled ()
(save-excursion
;; src
https://emacs.stackexchange.com/questions/72147/org-mode-adding-creation-date-property-upon-heading-creation
(org-schedule nil (format-time-string "[%Y-%m-%d %a]" nil))))
(add-hook 'org-insert-heading-hook 'my/org-heading-insert-scheduled
'append)
#+end_src
migrate-from-ts-header-to-created-property.org
Description: Text Data
OpenPGP_0x9D64597C3A982DCA.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature
- insert a header and automatically a timestamp with date/time, Uwe Brauer, 2025/02/01
- Re: insert a header and automatically a timestamp with date/time, pinmacs, 2025/02/01
- Re: insert a header and automatically a timestamp with date/time, Uwe Brauer, 2025/02/01
- Re: insert a header and automatically a timestamp with date/time,
Pedro <=
- Re: insert a header and automatically a timestamp with date/time, Uwe Brauer, 2025/02/02
- Re: insert a header and automatically a timestamp with date/time, pinmacs, 2025/02/02
- Re: insert a header and automatically a timestamp with date/time, Uwe Brauer, 2025/02/02
- Re: insert a header and automatically a timestamp with date/time, pinmacs, 2025/02/02
- Re: insert a header and automatically a timestamp with date/time, Uwe Brauer, 2025/02/03