From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniele Nicolodi Subject: Re: Insert datetree entry Date: Tue, 4 Apr 2017 12:42:24 -0600 Message-ID: <92332b50-c4a8-73a3-f506-c058fb54b9de@grinta.net> References: <87fuhp83ls.fsf@topd0g> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvTPW-0005no-22 for emacs-orgmode@gnu.org; Tue, 04 Apr 2017 14:42:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvTPR-00036v-37 for emacs-orgmode@gnu.org; Tue, 04 Apr 2017 14:42:34 -0400 Received: from zed.grinta.net ([109.74.203.128]:51826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvTPQ-000350-NT for emacs-orgmode@gnu.org; Tue, 04 Apr 2017 14:42:29 -0400 Received: from 688dnmac.campus.nist.gov (unknown [132.163.81.39]) (Authenticated sender: daniele) by zed.grinta.net (Postfix) with ESMTPSA id C74A6E30C0 for ; Tue, 4 Apr 2017 18:42:26 +0000 (UTC) In-Reply-To: <87fuhp83ls.fsf@topd0g> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org On 4/3/17 5:37 PM, Bruce V Chiarelli wrote: > > 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. Hi Bruce, thanks for the hint, but I don't understand what `subtree-at-point` is in your code, it does not seem to be defined in my emacs and `org-datetree-find-date-create` has a third parameter that is interpreted as a boolean. I'm confused. Cheers, Daniele