From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org structuresin a drawer? (or some other presentation soution) Date: Thu, 12 Sep 2013 21:41:30 +0200 Message-ID: <87hadpq13p.fsf@gmail.com> References: <871u4uq7c4.fsf@gmail.com> <87sixaorpw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKCla-0005YR-Vn for emacs-orgmode@gnu.org; Thu, 12 Sep 2013 15:41:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKClR-0002Ll-UK for emacs-orgmode@gnu.org; Thu, 12 Sep 2013 15:41:26 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:65233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKClR-0002Lh-O8 for emacs-orgmode@gnu.org; Thu, 12 Sep 2013 15:41:17 -0400 Received: by mail-wi0-f170.google.com with SMTP id cb5so128451wib.3 for ; Thu, 12 Sep 2013 12:41:16 -0700 (PDT) In-Reply-To: (Carsten Dominik's message of "Thu, 12 Sep 2013 21:13:33 +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: Carsten Dominik Cc: Org Mode Hello, Carsten Dominik writes: > Well, it is to avoid that a new headline would be made inside a drawer, > because it would violate Org syntax. But of course, it would be OK to > insert an item. What would be a good solution? Maybe we better catch > this problem in org-insert-heading? Or maybe not at all? We also do > not catch it in src block, for example. So I am fine with removing > this condition in org-meta-return. I suggest to be very permissive and allow a user to shoot himself in the foot. The following function implements the same behaviour as before, without the drawer check, but with Elements. (defun org-meta-return (&optional arg) "Insert a new heading or wrap a region in a table. Calls `org-insert-heading' or `org-table-wrap-region', depending on context. See the individual commands for more information." (interactive "P") (org-check-before-invisible-edit 'insert) (or (run-hook-with-args-until-success 'org-metareturn-hook) (let* ((element (org-element-at-point)) (type (org-element-type element))) (when (eq type 'table-row) (setq element (org-element-property :parent element))) (if (and (eq type 'table) (eq (org-element-property :type element) 'org) (>= (point) (org-element-property :contents-begin element)) (< (point) (org-element-property :contents-end element))) (call-interactively 'org-table-wrap-region) (call-interactively 'org-insert-heading))))) Regards, -- Nicolas Goaziou