diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2009-10-31 09:24:32 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2009-10-31 09:24:32 +0100 |
commit | 535ca7a6b949580bb61e03cab97f4947630bd76f (patch) | |
tree | 92401eb8484fb6f0b7620fffc2754f2768fee572 | |
parent | 41b8de947667daf10de07ff0a3e4488255ffb173 (diff) | |
download | org-mode-535ca7a6b949580bb61e03cab97f4947630bd76f.tar.gz |
Fix bug in CSV table import
Dan Davison writes:
> If a file contains "-1" followed by a newline and nothing else,
> org-table-import on that file fails. The first commit with this
> property is a commit (below) to do with CVS tables made a few
> days ago. I have given up trying to work out a good solution to
> this :) In case it is useful, the failure occurs when
> org-table-align is called at the end of
> org-table-convert-region. I think it is long-standing behaviour
> that hitting tab inside of
>
> |-1|
>
> doesn't make a table containing "-1", so presumably there is
> something different about the context in which org-table-align is
> now being called.
-rwxr-xr-x | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/org-table.el | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bc6016a..eee8a3c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2009-10-31 Carsten Dominik <carsten.dominik@gmail.com> + + * org-table.el (org-table-convert-region): Inert spaces around "|" + to avoid line beginnings like "|-1" which will be mistaken as + hlines. + 2009-10-30 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-offer-links-in-entry): Return nil if there are no diff --git a/lisp/org-table.el b/lisp/org-table.el index df586d5..e12c581 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -429,15 +429,14 @@ nil When nil, the command tries to be smart and figure out the (while (<= (point) end) ;; parse the csv stuff (cond - ((looking-at "^") (insert "|")) - ((looking-at "[ \t]*$") (replace-match "|") (beginning-of-line 2)) + ((looking-at "^") (insert "| ")) + ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2)) ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"") (replace-match "\\1") (if (looking-at "\"") (insert "\""))) ((looking-at "[^,\n]+") (goto-char (match-end 0))) ((looking-at "[ \t]*,") (replace-match " | ")) - (t (beginning-of-line 2) - (if (< (point) end) (insert "|"))))) + (t (beginning-of-line 2)))) (setq re (cond ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") ((equal separator '(16)) "^\\|\t") |