emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Insert datetree entry


From: Bruce V Chiarelli
Subject: Re: [O] Insert datetree entry
Date: Mon, 03 Apr 2017 16:37:35 -0700
User-agent: mu4e 0.9.19; emacs 26.0.50

Daniele Nicolodi writes:

> Hello,
>
> there is a way in org-mode to insert a datetree entry without going
> through the org-capture?  Ideally the function would jump to the
> datetree and inser an headline for the current day if one is not
> present, or move to the end of it if one is present.
>
> I haven't found anything like this in the manual. I'm now digging in the
> code. Hopefully it is not something too hard to implement with my
> lacking elisp knowledge.

I don't believe there really is one, but I've had to do it a couple of
times myself. This is my solution (I'm not a lisp expert either, but it
did the job):

(defun bc/org-new-datetree-at-point
       (interactive)
       (org-up-heading-safe)
       (org-datetree-find-date-create
         (calendar-gregorian-from-absolute (org-today))
         'subtree-at-point))

This will make the datetree as a subheading of the current heading (or
find it if it already exists). Getting rid of 'subtree-at-point will
make the year a level 1 heading at the end of the file, like with
org-capture.

Bruce

--
Bruce V. Chiarelli
http://github.com/bccomm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]