فهرست منبع

Merge branch 'maint' of orgmode.org:org-mode into maint

Bastien Guerry 13 سال پیش
والد
کامیت
1ec188b00a
3فایلهای تغییر یافته به همراه69 افزوده شده و 2 حذف شده
  1. 2 1
      lisp/ob-R.el
  2. 1 1
      lisp/ob.el
  3. 66 0
      testing/lisp/test-ob.el

+ 2 - 1
lisp/ob-R.el

@@ -279,7 +279,8 @@ last statement in BODY, as elisp."
      (with-temp-buffer
        (insert (org-babel-chomp body))
        (let ((ess-local-process-name
-	      (process-name (get-buffer-process session))))
+	      (process-name (get-buffer-process session)))
+	     (ess-eval-visibly-p nil))
 	 (ess-eval-buffer nil)))
      (let ((tmp-file (org-babel-temp-file "R-")))
        (org-babel-comint-eval-invisibly-and-wait-for-file

+ 1 - 1
lisp/ob.el

@@ -2150,7 +2150,7 @@ block but are passed literally to the \"example-block\"."
       (with-temp-buffer
         (insert body) (goto-char (point-min))
         (setq index (point))
-        (while (and (re-search-forward "<<\\([^ \t].+?[^ \t]\\|[^ \t]\\)>>"
+        (while (and (re-search-forward "<<\\([^ \t\n].+?[^ \t\n]\\|[^ \t\n]\\)>>"
 				       nil t))
           (save-match-data (setf source-name (match-string 1)))
           (save-match-data (setq evaluate (string-match "\(.*\)" source-name)))

+ 66 - 0
testing/lisp/test-ob.el

@@ -588,6 +588,72 @@ on two lines
 	   (org-babel-balanced-split ":a 1 :b [2 3] :c (4 :d (5 6))"
 				     '((32 9) . 58)))))
 
+(ert-deftest test-org-babel/inline-src_blk-preceded-punct-preceded-by-point ()
+  (let ((test-line ".src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+    (org-test-with-temp-text
+	test-line
+      (forward-char 1)
+      (org-ctrl-c-ctrl-c)
+      (should (string= (concat test-line " =\"x\"=")
+		       (buffer-substring-no-properties
+			(point-min) (point-max)))))))
+
+(ert-deftest test-org-babel/inline-src-block-preceded-by-equality ()
+  (let ((test-line "=src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+    (org-test-with-temp-text
+	test-line
+      (forward-char 1)
+      (org-ctrl-c-ctrl-c)
+      (should (string= (concat test-line " =\"x\"=")
+		       (buffer-substring-no-properties
+			(point-min) (point-max)))))))
+
+(ert-deftest test-org-babel/inline-src-block-enclosed-within-parenthesis ()
+  (let ((test-line "(src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+    (org-test-with-temp-text
+	(concat test-line ")")
+      (forward-char 1)
+      (org-ctrl-c-ctrl-c)
+      (should (string= (concat test-line " =\"x\"=)" )
+		       (buffer-substring-no-properties
+			(point-min) (point-max)))))))
+
+(ert-deftest test-org-babel/inline-src-block-enclosed-within-parenthesis ()
+  (let ((test-line "{src_emacs-lisp[ :results verbatim ]{ \"x\"  }"))
+    (org-test-with-temp-text
+	(concat test-line "}")
+      (forward-char 1)
+      (org-ctrl-c-ctrl-c)
+      (should (string= (concat test-line " =\"x\"=}")
+		       (buffer-substring-no-properties
+			(point-min) (point-max)))))))
+
+(ert-deftest test-org-babel/inline-src_blk-preceded-by-letter ()
+  "Test inline source block invalid where preceded by letter"
+
+  ;; inline-src-blk preceded by letter
+  (org-test-with-temp-text
+      "asrc_emacs-lisp[ :results verbatim ]{ \"x\"  }"
+    (forward-char 1)
+    (let ((error-result
+	   (should-error
+	    (org-ctrl-c-ctrl-c))))
+      (should (equal `(error "C-c C-c can do nothing useful at this location")
+		     error-result)))))
+
+(ert-deftest test-org-babel/inline-src_blk-preceded-by-number ()
+  "Test inline source block invalid where preceded by number"
+
+  ;; inline-src-blk preceded by number
+  (org-test-with-temp-text
+      "0src_emacs-lisp[ :results verbatim ]{ \"x\"  }"
+    (forward-char 1)
+    (let ((error-result
+	   (should-error
+	    (org-ctrl-c-ctrl-c))))
+      (should (equal `(error "C-c C-c can do nothing useful at this location")
+		     error-result)))))
+
 (provide 'test-ob)
 
 ;;; test-ob ends here