emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Anders Johansson <mejlaandersj@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Suggestion/bug: Parse inlinetask "END" with level sensitivity
Date: Mon, 17 Feb 2014 18:44:39 +0100	[thread overview]
Message-ID: <53024A87.6030901@gmail.com> (raw)

Hi.
I recently started using inlinetasks to be able to tag and comment long 
texts (a kind of simple qualitative data analysis).

I thought that I would be able to use both tasks with and without an 
"END" line interchangeably:

*************** inlinetask without end
some text

*************** inlinetask with end
                         text inside inlinetask
*************** END

The problem (not so surprising really) is that the parser finds the 
"END" of the second inlinetask and makes them nested in an export.

I thought this could be solved with using different numbers of stars for 
tasks with and without END, judging from these lines in org-inlinetask.el:
;; If you need to have a time planning line (DEADLINE etc), drawers,
;; for example LOGBOOK of PROPERTIES, or even normal text as part of
;; the inline task, you must add an "END" headline with the same
;; number of stars.

But the search for "END" in the parser is actually star-insensitive so 
this didn't solve my problem either.

I suggest requiring the "END"-line to contain as many stars as it's 
beginning line by doing something like this (there is certainly a 
cleaner way doing it) to org-element-inlinetask-parser:

@@ -972,7 +972,9 @@
            plist))))
         (task-end (save-excursion
                 (end-of-line)
-               (and (re-search-forward "^\\*+ END" limit t)
+               (and (re-search-forward
+                     (concat "^" (mapconcat 'identity (make-list (nth 1 
components) "\\*") "") " END")
+                     limit t)
                  (match-beginning 0))))
         (contents-begin (progn (forward-line)
                    (and task-end (< (point) task-end) (point))))

But perhaps this is too unstable? (Although it could be expected from 
the comments above).

Cheers,
Anders Johansson

             reply	other threads:[~2014-02-17 17:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 17:44 Anders Johansson [this message]
2014-02-17 22:05 ` Suggestion/bug: Parse inlinetask "END" with level sensitivity Nicolas Goaziou
2014-02-17 23:22   ` Anders Johansson

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=53024A87.6030901@gmail.com \
    --to=mejlaandersj@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).