emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: pinmacs <pinmacs@cas.cat>
To: emacs-orgmode@gnu.org
Subject: Re: insert a header and automatically a timestamp with date/time
Date: Sun, 2 Feb 2025 13:03:14 +0100	[thread overview]
Message-ID: <04b5ac66-2184-40ee-9269-68db7fa9309e@cas.cat> (raw)
In-Reply-To: <878qqodceb.fsf@mat.ucm.es>

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


On 2025-02-02 08:38, Uwe Brauer via General discussions about Org-mode. 
wrote:
> Vale, entendido (supongo que eres español, porque usas la palabra movil,
> ¿correcto?)
Yes :D
   but let's keep the discussion in the mailinglist in English so other 
people can participate, or benefit from it
> Thanks, but I cannot find the function
>
> my/set-property-with-inactive-timestamp
>
> In your code,

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

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

[-- Attachment #2: Type: text/html, Size: 1899 bytes --]

  reply	other threads:[~2025-02-02 12:04 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 [this message]
2025-02-02 20:02           ` Uwe Brauer via General discussions about Org-mode.
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=04b5ac66-2184-40ee-9269-68db7fa9309e@cas.cat \
    --to=pinmacs@cas.cat \
    --cc=emacs-orgmode@gnu.org \
    /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).