Thorsten Jolitz <tjol...@gmail.com> writes:

> Lawrence Bottorff <galaxybeinglam...@gmail.com> writes:
>
>> I'm trying to give each header entry a timestamp.
>
> This is from Bernt Hansen and automagically inserts a timestamp each
> time you insert a new header - if you want so. 
> If not, you can toggle the behaviour. Nice.
>
> ,------------------------------------------------------------------------
> | (defvar bh/insert-inactive-timestamp t)
> | 
> | (defun bh/toggle-insert-inactive-timestamp ()
> |   (interactive)
> |   (setq bh/insert-inactive-timestamp (not bh/insert-inactive-timestamp))
> |   (message "Heading timestamps are %s"
> |            (if bh/insert-inactive-timestamp "ON" "OFF")))
> | 
> | (defun bh/insert-inactive-timestamp ()
> |   (interactive)
> |   (org-insert-time-stamp nil t t nil nil nil))
> | 
> | (defun bh/insert-heading-inactive-timestamp ()
> |   (save-excursion
> |     (when bh/insert-inactive-timestamp
> |       (org-return)
> |       (org-cycle)
> |       (bh/insert-inactive-timestamp))))
> | 
> | (add-hook 'org-insert-heading-hook
> | 'bh/insert-heading-inactive-timestamp 'append)
> `-------------------------------------------------------------------------
>
> ,---------------------------------------------------------------------
> | (global-set-key (kbd "<f9> T") 'bh/toggle-insert-inactive-timestamp)
> | (global-set-key (kbd "<f9> t") 'bh/insert-inactive-timestamp)
> `---------------------------------------------------------------------
>
> -- 
> cheers,
> Thorsten
>
>

Moreover, if you also use org-capture. You may precise a timestamp to be
put in the captured template. IIRC, This is also inspired from Bernt's
configuration.

╭────
│ (add-to-list 'org-capture-templates
│                         '("t" "Todo Item" entry (file+headline 
(expand-file-name "todo.org" org-directory) "Refile") "* TODO %?
│   :LOGBOOK:
│   - Captured       %U
│   :END:
│ "
│                                :kill-buffer
│                        )
│   )
╰────
The useful part here is the %U. (see info:org#Template expansion).

This is of course to adjust according to your needs.

-- 
Konubinix
GPG Key    : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

Attachment: pgp5Yimd_s0P1.pgp
Description: PGP signature

Reply via email to