From 660e30b39c021ab7d1003d79f2e0debe1cba450c Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 30 Jan 2012 08:51:17 -0700 Subject: [PATCH 1/5] inline src block tests by Martyn Jago * testing/lisp/test-ob.el (test-org-babel/inline-src_blk-preceded-punct): Inline src block tests by Martyn Jago. --- testing/lisp/test-ob.el | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index c819facf2..e7e1eea8a 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -588,6 +588,75 @@ 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 () + "Test inline source block where preceded by punctuation" + + ;; inline-src-blk 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)))))) + + ;; inline-src-blk 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)))))) + + ;; inline-src-blk 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)))))) + + ;; inline-src-blk 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 From eb02808f975d70420f1328cdb343fe0a9d7a4746 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 30 Jan 2012 08:54:25 -0700 Subject: [PATCH 2/5] splitting large tests up into smaller units This make it easier to track down the cause of failing tests. --- testing/lisp/test-ob.el | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index e7e1eea8a..988ef3358 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -588,10 +588,7 @@ 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 () - "Test inline source block where preceded by punctuation" - - ;; inline-src-blk preceded by point +(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 @@ -599,9 +596,9 @@ on two lines (org-ctrl-c-ctrl-c) (should (string= (concat test-line " =\"x\"=") (buffer-substring-no-properties - (point-min) (point-max)))))) + (point-min) (point-max))))))) - ;; inline-src-blk preceded by equality +(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 @@ -609,9 +606,9 @@ on two lines (org-ctrl-c-ctrl-c) (should (string= (concat test-line " =\"x\"=") (buffer-substring-no-properties - (point-min) (point-max)))))) + (point-min) (point-max))))))) - ;; inline-src-blk enclosed within parenthesis +(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 ")") @@ -619,9 +616,9 @@ on two lines (org-ctrl-c-ctrl-c) (should (string= (concat test-line " =\"x\"=)" ) (buffer-substring-no-properties - (point-min) (point-max)))))) + (point-min) (point-max))))))) - ;; inline-src-blk enclosed within parenthesis +(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 "}") From 794319dfd9f11827ca0fce2043dfa95547eafe84 Mon Sep 17 00:00:00 2001 From: Vitalie Spinu Date: Mon, 30 Jan 2012 09:30:39 -0700 Subject: [PATCH 3/5] inhibit R evaluation visibility regardless of local user customization * lisp/ob-R.el (org-babel-R-evaluate-session): Inhibit R evaluation visibility regardless of local user customization. --- lisp/ob-R.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index d8c3d6bbf..ad18984a6 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -279,8 +279,9 @@ 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)))) - (ess-eval-buffer nil))) + (process-name (get-buffer-process session))) + (ess-eval-visibly-p nil)) + (ess-eval-buffer))) (let ((tmp-file (org-babel-temp-file "R-"))) (org-babel-comint-eval-invisibly-and-wait-for-file session tmp-file From 7b59410c30a7ef77a84d36f625fe7fc648f99fa6 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 30 Jan 2012 18:27:33 -0700 Subject: [PATCH 4/5] don't allow newlines in source names in noweb references * lisp/ob.el (org-babel-expand-noweb-references): Don't allow newlines in source names in noweb references. --- lisp/ob.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob.el b/lisp/ob.el index 88d92ea1d..3616b0b42 100644 --- a/lisp/ob.el +++ b/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))) From 900b988742f52cf88ae976b89587591a52709a53 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 30 Jan 2012 18:35:49 -0700 Subject: [PATCH 5/5] fix bug introduced by 794319dfd9f11827ca0fce2043dfa95547eafe84 --- lisp/ob-R.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index ad18984a6..05e3f486b 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -281,7 +281,7 @@ last statement in BODY, as elisp." (let ((ess-local-process-name (process-name (get-buffer-process session))) (ess-eval-visibly-p nil)) - (ess-eval-buffer))) + (ess-eval-buffer nil))) (let ((tmp-file (org-babel-temp-file "R-"))) (org-babel-comint-eval-invisibly-and-wait-for-file session tmp-file