From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: org structuresin a drawer? (or some other presentation soution)
Date: Thu, 12 Sep 2013 21:41:30 +0200 [thread overview]
Message-ID: <87hadpq13p.fsf@gmail.com> (raw)
In-Reply-To: <D95AE32D-FE3C-4354-9AB6-AE3B147302CA@gmail.com> (Carsten Dominik's message of "Thu, 12 Sep 2013 21:13:33 +0200")
Hello,
Carsten Dominik <carsten.dominik@gmail.com> 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
next prev parent reply other threads:[~2013-09-12 19:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 17:06 org structuresin a drawer? (or some other presentation soution) Matt Price
2013-09-12 17:16 ` Thorsten Jolitz
2013-09-12 17:38 ` Matt Price
2013-09-12 17:26 ` Nicolas Goaziou
2013-09-12 17:30 ` Matt Price
2013-09-12 17:49 ` Nicolas Goaziou
2013-09-12 19:13 ` Carsten Dominik
2013-09-12 19:18 ` Michael Brand
2013-09-12 19:24 ` Carsten Dominik
2013-09-12 20:17 ` Nicolas Goaziou
2013-09-12 19:41 ` Nicolas Goaziou [this message]
2013-09-12 20:13 ` Nicolas Goaziou
2013-09-12 20:16 ` Carsten Dominik
2013-09-12 20:35 ` Nicolas Goaziou
2013-09-12 20:41 ` Carsten Dominik
2013-09-12 20:42 ` Michael Brand
2013-09-13 0:43 ` Matt Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hadpq13p.fsf@gmail.com \
--to=n.goaziou@gmail.com \
--cc=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).