|
@@ -581,14 +581,15 @@ Escaping happens when a line starts with \"*\", \"#+\", \",*\" or
|
|
(interactive "r")
|
|
(interactive "r")
|
|
(save-excursion
|
|
(save-excursion
|
|
(goto-char end)
|
|
(goto-char end)
|
|
- (while (re-search-backward "^[ \t]*,?\\(\\*\\|#\\+\\)" beg t)
|
|
|
|
|
|
+ (while (re-search-backward "^[ \t]*\\(,*\\(?:\\*\\|#\\+\\)\\)" beg t)
|
|
(save-excursion (replace-match ",\\1" nil nil nil 1)))))
|
|
(save-excursion (replace-match ",\\1" nil nil nil 1)))))
|
|
|
|
|
|
(defun org-escape-code-in-string (s)
|
|
(defun org-escape-code-in-string (s)
|
|
"Escape lines in string S.
|
|
"Escape lines in string S.
|
|
Escaping happens when a line starts with \"*\", \"#+\", \",*\" or
|
|
Escaping happens when a line starts with \"*\", \"#+\", \",*\" or
|
|
\",#+\" by appending a comma to it."
|
|
\",#+\" by appending a comma to it."
|
|
- (replace-regexp-in-string "^[ \t]*,?\\(\\*\\|#\\+\\)" ",\\1" s nil nil 1))
|
|
|
|
|
|
+ (replace-regexp-in-string "^[ \t]*\\(,*\\(?:\\*\\|#\\+\\)\\)" ",\\1"
|
|
|
|
+ s nil nil 1))
|
|
|
|
|
|
(defun org-unescape-code-in-region (beg end)
|
|
(defun org-unescape-code-in-region (beg end)
|
|
"Un-escape lines between BEG and END.
|
|
"Un-escape lines between BEG and END.
|
|
@@ -597,7 +598,7 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
|
|
(interactive "r")
|
|
(interactive "r")
|
|
(save-excursion
|
|
(save-excursion
|
|
(goto-char end)
|
|
(goto-char end)
|
|
- (while (re-search-backward "^[ \t]*,?\\(,\\)\\(?:\\*\\|#\\+\\)" beg t)
|
|
|
|
|
|
+ (while (re-search-backward "^[ \t]*,*\\(,\\)\\(?:\\*\\|#\\+\\)" beg t)
|
|
(save-excursion (replace-match "" nil nil nil 1)))))
|
|
(save-excursion (replace-match "" nil nil nil 1)))))
|
|
|
|
|
|
(defun org-unescape-code-in-string (s)
|
|
(defun org-unescape-code-in-string (s)
|
|
@@ -605,7 +606,7 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
|
|
Un-escaping happens by removing the first comma on lines starting
|
|
Un-escaping happens by removing the first comma on lines starting
|
|
with \",*\", \",#+\", \",,*\" and \",,#+\"."
|
|
with \",*\", \",#+\", \",,*\" and \",,#+\"."
|
|
(replace-regexp-in-string
|
|
(replace-regexp-in-string
|
|
- "^[ \t]*,?\\(,\\)\\(?:\\*\\|#\\+\\)" "" s nil nil 1))
|
|
|
|
|
|
+ "^[ \t]*,*\\(,\\)\\(?:\\*\\|#\\+\\)" "" s nil nil 1))
|
|
|
|
|
|
|
|
|
|
|
|
|