[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org structuresin a drawer? (or some other presentation soution)

From: Carsten Dominik
Subject: Re: [O] org structuresin a drawer? (or some other presentation soution)
Date: Thu, 12 Sep 2013 22:16:16 +0200

Hi Nicolas, this looks good to me, please apply it.


- Carsten

On 12.9.2013, at 21:41, Nicolas Goaziou <address@hidden> wrote:

> Hello,
> Carsten Dominik <address@hidden> 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

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

reply via email to

[Prev in Thread] Current Thread [Next in Thread]