From 737757a5fd89e6da8c26c9af5ce2a45060cae914 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 8 Jun 2009 09:39:19 +0200 Subject: [PATCH] Allow for extra indentation of block contents. --- lisp/ChangeLog | 3 +++ lisp/org-src.el | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d09ca6245..1b78919fe 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2009-06-08 Carsten Dominik + * org-src.el (org-edit-src-content-indentation): New option. + (org-edit-src-exit): Apply extra indentation. + * org-exp.el (org-export-format-source-code-or-example): Run `org-src-mode-hook'. diff --git a/lisp/org-src.el b/lisp/org-src.el index a0bb30177..401c628f8 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -80,6 +80,14 @@ These are the regions where each line starts with a colon." (const fundamental-mode) (function :tag "Other (specify)"))) +(defcustom org-edit-src-content-indentation 2 + "Indentation for the content is a source code block. +This should be the number of spaces added to the indentation of the #+begin +line in order to compute the indentation of the block content after +editing it with \\[org-edit-src-code]." + :group 'org-edit-structure + :type 'integer) + (defcustom org-edit-src-persistent-message t "Non-nil means show persistent exit help message while editing src examples. The message is shown in the header-line, which will be created in the @@ -426,7 +434,8 @@ the language, a switch telling of the content should be in a single line." (while (re-search-forward "^" nil t) (replace-match ": "))) (when nindent - (setq nindent (make-string nindent ?\ )) + (setq nindent (make-string (+ org-edit-src-content-indentation nindent) + ?\ )) (goto-char (point-min)) (while (re-search-forward "^" nil t) (replace-match nindent))) -- 2.11.4.GIT