emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org.el: Preserve indentation of manually indented lines in example blocks.
@ 2011-08-08 19:48 Valentin Wüstholz
  2011-08-08 20:40 ` Nicolas Goaziou
  0 siblings, 1 reply; 17+ messages in thread
From: Valentin Wüstholz @ 2011-08-08 19:48 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

Hi,

lines in example blocks are currently indented like the surrounding
begin and end delimiters. ¨This works fine unless, you want to indent
some lines manually; in this case, auto-indenting the buffer reverts
the manual indentation. This patch should prevent this from happening.

Best regards,

Valentin

[-- Attachment #2: org.el.patch.txt --]
[-- Type: text/plain, Size: 1047 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 11eaf78..428804d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19460,10 +19460,14 @@ If point is in an inline task, mark that task instead."
       (save-excursion
 	(re-search-backward "^[ \t]*#\\+begin_\\([a-z]+\\)" nil t))
       (setq column
-	    (if (equal (downcase (match-string 1)) "src")
-		;; src blocks: let `org-edit-src-exit' handle them
-		(org-get-indentation)
-	      (org-get-indentation (match-string 0)))))
+            (cond ((equal (downcase (match-string 1)) "src")
+                   ;; src blocks: let `org-edit-src-exit' handle them
+                   (org-get-indentation))
+                  ((equal (downcase (match-string 1)) "example")
+                   (max (org-get-indentation) (org-get-indentation (match-string 0))))
+                  (t
+                   (org-get-indentation (match-string 0)))
+                  )))
      ;; This line has nothing special, look at the previous relevant
      ;; line to compute indentation
      (t

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-08-26  6:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-08 19:48 [PATCH] org.el: Preserve indentation of manually indented lines in example blocks Valentin Wüstholz
2011-08-08 20:40 ` Nicolas Goaziou
2011-08-08 21:04   ` Valentin Wüstholz
2011-08-08 22:33     ` Nicolas Goaziou
2011-08-09  5:42       ` Valentin Wüstholz
2011-08-09  9:18         ` Nicolas Goaziou
2011-08-09 12:10           ` Valentin Wüstholz
2011-08-09 13:21             ` Nicolas Goaziou
2011-08-09 19:37               ` Valentin Wüstholz
2011-08-10  9:00                 ` Nicolas Goaziou
2011-08-16 17:21                   ` Bastien
2011-08-16 19:18                 ` Bastien
2011-08-16 21:33                   ` Valentin Wüstholz
2011-08-17  9:40                     ` Bastien
2011-08-17 18:32                       ` Valentin Wüstholz
2011-08-18 16:44                         ` Bastien
2011-08-26  6:45                           ` Valentin Wüstholz

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).