From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: org-agenda-insert-diary-make-new-entry adds entry as first child? Date: Mon, 28 Jul 2014 16:20:42 +0200 Message-ID: <87ha21xuob.fsf@bzg.ath.cx> References: <87vbsnmpqo.fsf@bzg.ath.cx> <8761kn8ir9.fsf@bzg.ath.cx> <87wqd3s30s.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBofx-0007kn-DO for emacs-orgmode@gnu.org; Mon, 28 Jul 2014 13:25:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XBoff-0005wH-9u for emacs-orgmode@gnu.org; Mon, 28 Jul 2014 13:25:29 -0400 Received: from mail-s76.mailgun.info ([184.173.153.204]:52313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBoff-0005j9-6z for emacs-orgmode@gnu.org; Mon, 28 Jul 2014 13:25:11 -0400 In-Reply-To: (Nikolai Weibull's message of "Fri, 30 May 2014 18:12:50 +0200") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nikolai Weibull Cc: emacs-orgmode@gnu.org Hi Nikolai, Nikolai Weibull writes: > Here’s a suggested solution. We keep track of whether the parent > entry already has any children, then we call org-insert-heading with > two universal arguments to add an entry at the end of the current > subtree. Finally, if there weren’t any children already, we demote > the entry we added so that it becomes a child of the parent entry. Finally applied in master, thanks, > Please note that this was written while eating dinner with my kid. Bon appétit ! -- Bastien