From 23b4026937572339a453922bb79a05d1e82597e7 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 12 Oct 2009 12:13:08 -0400 Subject: [PATCH] org-src-mode: maintain relative location of point when lines are protected --- lisp/org-src.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 796e914e..03e5b458 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -229,6 +229,7 @@ the edited version." (when org-mode-p (goto-char (point-min)) (while (re-search-forward "^," nil t) + (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent))) (replace-match ""))) (org-goto-line (1+ (- line begline))) (org-move-to-column @@ -463,7 +464,7 @@ the language, a switch telling if the content should be in a single line." (total-nindent (+ (or org-edit-src-block-indentation 0) org-edit-src-content-indentation)) (preserve-indentation org-src-preserve-indentation) - code line col indent) + (delta 0) code line col indent) (untabify (point-min) (point-max)) (save-excursion (goto-char (point-min)) @@ -490,6 +491,7 @@ the language, a switch telling if the content should be in a single line." (goto-char (point-min)) (while (re-search-forward (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) + (if (eq (org-current-line) line) (setq delta (1+ delta))) (replace-match ",\\1"))) (when (org-bound-and-true-p org-edit-src-picture) (setq preserve-indentation nil) @@ -514,7 +516,7 @@ the language, a switch telling if the content should be in a single line." (goto-char beg) (if single (just-one-space)) (org-goto-line (1- (+ (org-current-line) line))) - (org-move-to-column (if preserve-indentation col (+ col total-nindent))) + (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))) (move-marker beg nil) (move-marker end nil))) -- 2.11.4.GIT