summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-06-02 17:17:17 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-06-02 17:17:17 +0200
commitf91d194d4fe4644de9cac94a807a08c220ab521d (patch)
treecfd27af5520c782e9f1b8d09f07cb30f1f88267e
parent0f93638ce1b29792033231426a4555e538f5c959 (diff)
downloadorg-mode-f91d194d4fe4644de9cac94a807a08c220ab521d.tar.gz
org-src: Fix `org-(un)escape-code-in-region'
* lisp/org-src.el (org-escape-code-in-region): (org-unescape-code-in-region): Fix functions. Reported-by: Daimrod <daimrod@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/98099>
-rw-r--r--lisp/org-src.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/org-src.el b/lisp/org-src.el
index c9a4517..2cceea5 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -519,9 +519,9 @@ Escaping happens when a line starts with \"*\", \"#+\", \",*\" or
\",#+\" by appending a comma to it."
(interactive "r")
(save-excursion
- (goto-char beg)
- (while (re-search-forward "^[ \t]*,?\\(\\*\\|#\\+\\)" end t)
- (replace-match ",\\1" nil nil nil 1))))
+ (goto-char end)
+ (while (re-search-backward "^[ \t]*,?\\(\\*\\|#\\+\\)" beg t)
+ (save-excursion (replace-match ",\\1" nil nil nil 1)))))
(defun org-escape-code-in-string (s)
"Escape lines in string S.
@@ -535,9 +535,9 @@ Un-escaping happens by removing the first comma on lines starting
with \",*\", \",#+\", \",,*\" and \",,#+\"."
(interactive "r")
(save-excursion
- (goto-char beg)
- (while (re-search-forward "^[ \t]*,?\\(,\\)\\(?:\\*\\|#\\+\\)" end t)
- (replace-match "" nil nil nil 1))))
+ (goto-char end)
+ (while (re-search-backward "^[ \t]*,?\\(,\\)\\(?:\\*\\|#\\+\\)" beg t)
+ (save-excursion (replace-match "" nil nil nil 1)))))
(defun org-unescape-code-in-string (s)
"Un-escape lines in string S.