diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-05-01 18:46:33 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-05-01 18:46:33 +0200 |
commit | 427403d0bb600ec6d83ae15a5470bd5175cf9bde (patch) | |
tree | fb41e32cddc454f4b5c05430eaf2e983a1d49dea | |
parent | 49a656a409c705f79a70542265f87ec21e9d63c8 (diff) | |
download | org-mode-427403d0bb600ec6d83ae15a5470bd5175cf9bde.tar.gz |
org-src: Remove `org-src--type'
* lisp/org-src.el (org-src--type): Remove variable.
(org-src--contents-for-write-back): Apply removal.
(org-edit-src-code): Add indentation in post-process.
-rw-r--r-- | lisp/org-src.el | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lisp/org-src.el b/lisp/org-src.el index ecdab0f..5af0b2d 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -203,7 +203,6 @@ issued in the language major mode buffer." (defvar org-src--from-org-mode nil) (defvar org-src--overlay nil) (defvar org-src--saved-temp-window-config nil) -(defvar org-src--type nil) (defvar org-src--babel-info nil) (defun org-src--construct-edit-buffer-name (org-buffer-name lang) @@ -337,13 +336,9 @@ END." (defun org-src--contents-for-write-back () "Return buffer contents in a format appropriate for write back. Assume point is in the corresponding edit buffer." - (let ((indentation (+ (or org-src--block-indentation 0) - (if (memq org-src--type '(example-block src-block)) - org-edit-src-content-indentation - 0))) + (let ((indentation (or org-src--block-indentation 0)) (preserve-indentation org-src-preserve-indentation) (contents (org-with-wide-buffer (buffer-string))) - (fixed-width-p (eq org-src--type 'fixed-width)) (write-back org-src--allow-write-back)) (with-temp-buffer (insert (org-no-properties contents)) @@ -432,7 +427,6 @@ Leave point in edit buffer." (org-set-local 'org-src--from-org-mode org-mode-p) (org-set-local 'org-src--beg-marker beg) (org-set-local 'org-src--end-marker end) - (org-set-local 'org-src--type type) (org-set-local 'org-src--remote remote) (org-set-local 'org-src--block-indentation ind) (org-set-local 'org-src-preserve-indentation preserve-ind) @@ -809,7 +803,12 @@ name of the sub-editing buffer." (and (null code) (lambda () (unless org-src-preserve-indentation - (untabify (point-min) (point-max))) + (untabify (point-min) (point-max)) + (when (> org-edit-src-content-indentation 0) + (let ((ind (make-string org-edit-src-content-indentation ?\s))) + (while (not (eobp)) + (unless (looking-at "[ \t]*$") (insert ind)) + (forward-line))))) (org-escape-code-in-region (point-min) (point-max)))) (and code (org-unescape-code-in-string code))) ;; Finalize buffer. |