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 22:13:08 +0200 Message-ID: <87d2odpzmz.fsf@gmail.com> References: <871u4uq7c4.fsf@gmail.com> <87sixaorpw.fsf@gmail.com> <87hadpq13p.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKDGG-0007pM-6G for emacs-orgmode@gnu.org; Thu, 12 Sep 2013 16:13:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKDG4-0002iM-Px for emacs-orgmode@gnu.org; Thu, 12 Sep 2013 16:13:08 -0400 Received: from mail-ea0-x231.google.com ([2a00:1450:4013:c01::231]:62644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKDG4-0002hJ-Hd for emacs-orgmode@gnu.org; Thu, 12 Sep 2013 16:12:56 -0400 Received: by mail-ea0-f177.google.com with SMTP id f15so140656eak.22 for ; Thu, 12 Sep 2013 13:12:54 -0700 (PDT) In-Reply-To: <87hadpq13p.fsf@gmail.com> (Nicolas Goaziou's message of "Thu, 12 Sep 2013 21:41:30 +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 Correcting myself, Nicolas Goaziou writes: > (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))) Oops. I forgot a (setq type 'table) within the `when'. > (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)))))