From 6c771d236dea88c96f3d807ffaa03fb680db437b Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Fri, 24 Jun 2011 14:53:30 -0700 Subject: [PATCH] ob: inserting inline call block results appropriately * lisp/ob-lob.el (org-babel-inline-lob-one-liner-regexp): Removing this trailing space ensures that the insertion of the results looks nice. * lisp/ob.el (org-babel-insert-result): Insert inline lob line results as inline results. --- lisp/ob-lob.el | 2 +- lisp/ob.el | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/ob-lob.el b/lisp/ob-lob.el index d7f583004..fbbc9758c 100644 --- a/lisp/ob-lob.el +++ b/lisp/ob-lob.el @@ -83,7 +83,7 @@ If you change the value of this variable then your files may "\\([^\n]*\\)\\(?:" (mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|") "\\)_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" - "\(\\([^\n]*\\)\)\\(\\[.+\\]\\|\\)\\(\\[\\([^\\[\\]]*\\)\\]\\)?[ \t]*") + "\(\\([^\n]*\\)\)\\(\\[.+\\]\\|\\)\\(\\[\\([^\\[\\]]*\\)\\]\\)?") "Regexp to match inline calls to predefined source block functions.") (defconst org-babel-lob-one-liner-regexp diff --git a/lisp/ob.el b/lisp/ob.el index cc03ed862..f4ec4ce0b 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -1529,12 +1529,14 @@ code ---- the results are extracted in the syntax of the source (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result) (save-excursion - (let* ((inlinep (save-excursion - (re-search-backward "[ \f\t\n\r\v]" nil t) - (when (looking-at org-babel-inline-src-block-regexp) - (goto-char (match-end 0)) - (insert (if (listp result) "\n" " ")) - (point)))) + (let* ((inlinep + (save-excursion + (re-search-backward "[ \f\t\n\r\v]" nil t) + (when (or (looking-at org-babel-inline-src-block-regexp) + (looking-at org-babel-inline-lob-one-liner-regexp)) + (goto-char (match-end 0)) + (insert (if (listp result) "\n" " ")) + (point)))) (existing-result (unless inlinep (org-babel-where-is-src-block-result t info hash indent)))