diff options
author | Dan Davison <davison@stats.ox.ac.uk> | 2010-04-10 16:49:40 -0400 |
---|---|---|
committer | Dan Davison <davison@stats.ox.ac.uk> | 2010-04-10 16:49:40 -0400 |
commit | 59d499ff51b2d0f19add834fe47e9ef42f7a763b (patch) | |
tree | 57874a3e5ca30682a4a511017ab910ae2f297ad4 | |
parent | 8c827ba5ba23d73e59dc69482059018615196a0c (diff) | |
download | org-mode-59d499ff51b2d0f19add834fe47e9ef42f7a763b.tar.gz |
babel: Allow table to end neatly with terminal hline
Prior to this, a terminal hline would leave dangling empty cells:
#+TBLNAME: A
|---+---+---|
| a | b | c |
|---+---+---|
#+begin_src emacs-lisp :var tab=A
tab
#+end_src
#+results:
|---+---+---|
| a | b | c |
|---+---+---|
| | | |
-rw-r--r-- | contrib/babel/lisp/org-babel.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el index a556c7d..9a651a2 100644 --- a/contrib/babel/lisp/org-babel.el +++ b/contrib/babel/lisp/org-babel.el @@ -776,20 +776,21 @@ code ---- the results are extracted in the syntax of the source (setq result (concat result "\n"))) (save-excursion (let ((existing-result (org-babel-where-is-src-block-result t info hash)) - (results-switches (cdr (assoc :results_switches (third info))))) + (results-switches (cdr (assoc :results_switches (third info)))) beg) (when existing-result (goto-char existing-result) (forward-line 1)) (setq results-switches (if results-switches (concat " " results-switches) "")) (cond ;; assume the result is a table if it's not a string ((not (stringp result)) + (setq beg (point)) (insert (concat (orgtbl-to-orgtbl (if (or (eq 'hline (car result)) (and (listp (car result)) (listp (cdr (car result))))) result (list result)) '(:fmt (lambda (cell) (format "%s" cell)))) "\n")) - (forward-line -1) (org-cycle)) + (goto-char beg) (org-cycle)) ((member "file" result-params) (insert result)) ((member "html" result-params) |