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.
This commit is contained in:
Eric Schulte 2011-06-24 14:53:30 -07:00
parent 825f6d382d
commit 6c771d236d
2 changed files with 9 additions and 7 deletions

View File

@ -83,7 +83,7 @@ If you change the value of this variable then your files may
"\\([^\n]*\\)\\(?:" "\\([^\n]*\\)\\(?:"
(mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|") (mapconcat #'regexp-quote org-babel-lob-call-aliases "\\|")
"\\)_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" "\\)_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)"
"\(\\([^\n]*\\)\)\\(\\[.+\\]\\|\\)\\(\\[\\([^\\[\\]]*\\)\\]\\)?[ \t]*") "\(\\([^\n]*\\)\)\\(\\[.+\\]\\|\\)\\(\\[\\([^\\[\\]]*\\)\\]\\)?")
"Regexp to match inline calls to predefined source block functions.") "Regexp to match inline calls to predefined source block functions.")
(defconst org-babel-lob-one-liner-regexp (defconst org-babel-lob-one-liner-regexp

View File

@ -1529,12 +1529,14 @@ code ---- the results are extracted in the syntax of the source
(message (replace-regexp-in-string "%" "%%" (format "%S" result))) (message (replace-regexp-in-string "%" "%%" (format "%S" result)))
result) result)
(save-excursion (save-excursion
(let* ((inlinep (save-excursion (let* ((inlinep
(re-search-backward "[ \f\t\n\r\v]" nil t) (save-excursion
(when (looking-at org-babel-inline-src-block-regexp) (re-search-backward "[ \f\t\n\r\v]" nil t)
(goto-char (match-end 0)) (when (or (looking-at org-babel-inline-src-block-regexp)
(insert (if (listp result) "\n" " ")) (looking-at org-babel-inline-lob-one-liner-regexp))
(point)))) (goto-char (match-end 0))
(insert (if (listp result) "\n" " "))
(point))))
(existing-result (unless inlinep (existing-result (unless inlinep
(org-babel-where-is-src-block-result (org-babel-where-is-src-block-result
t info hash indent))) t info hash indent)))