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>
This commit is contained in:
Nicolas Goaziou 2015-06-02 17:17:17 +02:00
parent 0f93638ce1
commit f91d194d4f
1 changed files with 6 additions and 6 deletions

View File

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