From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Stewart Subject: [PATCH] org.el: Fix indentation in lists after blocks with special env Date: Fri, 19 May 2017 23:41:40 -0400 Message-ID: <8760gw5gix.fsf@stoo.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBvTx-00074g-9G for emacs-orgmode@gnu.org; Fri, 19 May 2017 23:55:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBvTu-0000ET-0K for emacs-orgmode@gnu.org; Fri, 19 May 2017 23:55:09 -0400 Received: from mail-qt0-x232.google.com ([2607:f8b0:400d:c0d::232]:33104) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dBvTt-0000EF-Qj for emacs-orgmode@gnu.org; Fri, 19 May 2017 23:55:05 -0400 Received: by mail-qt0-x232.google.com with SMTP id t26so71617459qtg.0 for ; Fri, 19 May 2017 20:55:04 -0700 (PDT) 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" To: emacs-orgmode@gnu.org * 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