emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Stewart <tim@stoo.org>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org.el: Fix indentation in lists after blocks with special env
Date: Fri, 19 May 2017 23:41:40 -0400	[thread overview]
Message-ID: <8760gw5gix.fsf@stoo.org> (raw)

* lisp/org.el (org--get-expected-indentation): Fix indentation within
  lists after blocks that support a special editing environment.

Testing shows that the indentation within lists is incorrect after
`example-block', `export-block', and `source-block'.  The logic falls
through and makes a recursive call to `org-get-indentation' which
results in an indent to the same level as the last line of the block's
contents.

TINYCHANGE
---
 lisp/org.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 59f537b..441597a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -22604,6 +22604,13 @@ ELEMENT."
 	  ;; and contents.
 	  ((= (line-beginning-position) post-affiliated)
 	   (org--get-expected-indentation element t))
+	  ;; Line above is a `#+BEGIN_.../#+END_...' structural
+	  ;; element with support for special editing environments.
+	  ;; Make sure we indent to the same level as the element
+	  ;; instead of its contents.
+	  ((member (car (org-element-at-point))
+		   '(example-block export-block src-block))
+	   (org-get-indentation))
 	  ;; POS is after contents in a greater element.  Indent like
 	  ;; the beginning of the element.
 	  ((and (memq type org-element-greater-elements)
--
2.1.4

             reply	other threads:[~2017-05-20  3:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-20  3:41 Tim Stewart [this message]
2017-05-20  6:38 ` [PATCH] org.el: Fix indentation in lists after blocks with special env Nicolas Goaziou
2017-05-20 15:18   ` Tim Stewart
2017-06-12  1:52     ` Tim Stewart

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=8760gw5gix.fsf@stoo.org \
    --to=tim@stoo.org \
    --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).