From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce V Chiarelli Subject: Re: Insert datetree entry Date: Mon, 03 Apr 2017 16:37:35 -0700 Message-ID: <87fuhp83ls.fsf@topd0g> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvBXZ-0004yo-0i for emacs-orgmode@gnu.org; Mon, 03 Apr 2017 19:37:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvBXV-0007ZJ-TT for emacs-orgmode@gnu.org; Mon, 03 Apr 2017 19:37:41 -0400 Received: from mail-pg0-x22e.google.com ([2607:f8b0:400e:c05::22e]:35655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cvBXV-0007Ys-L2 for emacs-orgmode@gnu.org; Mon, 03 Apr 2017 19:37:37 -0400 Received: by mail-pg0-x22e.google.com with SMTP id 81so134768996pgh.2 for ; Mon, 03 Apr 2017 16:37:37 -0700 (PDT) In-reply-to: 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: Daniele Nicolodi Cc: emacs-orgmode@gnu.org 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