emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Uwe Brauer via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: emacs-orgmode@gnu.org
Subject: Re: insert a header and automatically a timestamp with date/time
Date: Sun, 02 Feb 2025 21:02:27 +0100	[thread overview]
Message-ID: <87seoww1ws.fsf@mat.ucm.es> (raw)
In-Reply-To: 04b5ac66-2184-40ee-9269-68db7fa9309e@cas.cat

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]


> On 2025-02-02 08:38, Uwe Brauer via General discussions about Org-mode. 
> wrote:
> Yes :D
>    but let's keep the discussion in the mailinglist in English so other 
> people can participate, or benefit from it


Sure!

> In fact you don't need ~my/get-inactive-timestamp~ for your pursposes, 
> try with this one:

> #+begin_src emacs-lisp
> (defun my/org-add-timestamp-on-heading ()
>    (save-excursion
>      (org-back-to-heading)
>      (org-edit-headline (format-time-string "<%F>"))))

> (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

I did this already 😉 thanks

Actually I used 
(defun my/org-add-timestamp-on-heading ()
  (save-excursion
    (org-back-to-heading)
    (org-edit-headline (format-time-string "<%Y-%m-%d %H:%M>")))
  (insert " "))

(add-hook 'org-insert-heading-hook 'my/org-add-timestamp-on-heading 'append)




> but here you have for curiosity, there you can see compact strftime 
> format to construct a inactive timestamp

> [1]

> #+begin_src emacs-lisp
> (defun my/get-inactive-timestamp ()
>    (format-time-string "[%F %a %R]"))

> (defun my/set-property-with-inactive-timestamp (property)
>    (interactive)
>    (org-set-property property (my/get-inactive-timestamp)))
> #+end_src

Thanks, I try that out.


A last question though.

Now if I want my headings look like 

* <2025-02-02 08:58> Second entry 

* <2025-02-02 08:53> First 

* <2025-02-02 08:56> third 



Is there any way to sort these heading with respect to the timestamps from oldes to newest?

-- 
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the EU and NATO membership of Ukraine. 


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5684 bytes --]

  reply	other threads:[~2025-02-02 20:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-01  7:55 insert a header and automatically a timestamp with date/time Uwe Brauer via General discussions about Org-mode.
2025-02-01 11:11 ` pinmacs via General discussions about Org-mode.
2025-02-01 17:43   ` Uwe Brauer via General discussions about Org-mode.
2025-02-01 21:04     ` Pedro
2025-02-02  7:38       ` Uwe Brauer via General discussions about Org-mode.
2025-02-02 12:03         ` pinmacs
2025-02-02 20:02           ` Uwe Brauer via General discussions about Org-mode. [this message]
2025-02-02 20:47             ` pinmacs
2025-02-03 18:07               ` Uwe Brauer via General discussions about Org-mode.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87seoww1ws.fsf@mat.ucm.es \
    --to=emacs-orgmode@gnu.org \
    --cc=oub@mat.ucm.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).