Browse Source

lisp/ob-J.el (obj-string-match-m): add missing function

Oleh Krehel 11 years ago
parent
commit
fa2e39148f
1 changed files with 8 additions and 1 deletions
  1. 8 1
      lisp/ob-J.el

+ 8 - 1
lisp/ob-J.el

@@ -39,7 +39,7 @@ PROCESSED-PARAMS isn't used yet."
 
 (defun org-babel-J-interleave-echos-except-functions (body)
   "Interleave echo'' between source lines of BODY that aren't functions."
-  (if (string-match-m "\\(?:^\\|\n\\)[^\n]*\\(?:1\\|2\\|3\\|4\\) : 0\n.*)" body)
+  (if (obj-string-match-m "\\(?:^\\|\n\\)[^\n]*\\(?:1\\|2\\|3\\|4\\) : 0\n.*)" body)
       (let ((s1 (substring body 0 (match-beginning 0)))
 	    (s2 (match-string 0 body))
 	    (s3 (substring body (match-end 0))))
@@ -121,6 +121,13 @@ This function is called by `org-babel-execute-src-block'"
   (and (string-match "^ *\\([^ ].*\\)" s)
        (match-string 1 s)))
 
+(defun obj-string-match-m (regexp string &optional start)
+  "Like `sting-match', only .* includes newlines too."
+  (string-match
+   (replace-regexp-in-string "\\.\\*" "[\0-\377[:nonascii:]]*" regexp)
+   string
+   start))
+
 (defun org-babel-j-initiate-session (&optional session)
   "Initiate a J session.
 SESSION is a parameter given by org-babel."