From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-element-adopt-elements, append before children Date: Mon, 03 Sep 2018 10:04:26 +0200 Message-ID: <87bm9fuhv9.fsf@nicolasgoaziou.fr> References: <8736usxewt.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwjqk-0001yD-Nc for emacs-orgmode@gnu.org; Mon, 03 Sep 2018 04:04:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwjqh-0006Lf-If for emacs-orgmode@gnu.org; Mon, 03 Sep 2018 04:04:42 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:46959) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fwjqh-0006L5-CL for emacs-orgmode@gnu.org; Mon, 03 Sep 2018 04:04:39 -0400 In-Reply-To: (Ivan Tadeu Ferreira Antunes Filho's message of "Sun, 2 Sep 2018 16:48:23 -0400") 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: Ivan Tadeu Ferreira Antunes Filho Cc: emacs-orgmode@gnu.org Hello, Ivan Tadeu Ferreira Antunes Filho writes: > Org element insert before would insert the new element before the selected > element, not as the first element child (I think) > > > At the moment I'm finding the first child, checking if it is non nil, and > if it is not nil, dolist insert before the first child, else, adopt the > elements. Which is a fairly convoluted way The current way would be: find first child if any; if there is not, adopt, otherwise, insert before it. In any case, feel free to provide a patch, along with some tests to implement what you suggest. Regards, -- Nicolas Goaziou 0x80A93738