[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] limitations of hard-coded field separator removed
From: |
Bastien |
Subject: |
Re: [O] limitations of hard-coded field separator removed |
Date: |
Tue, 27 Mar 2012 23:44:37 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) |
Hi Andreas,
Andreas Röhler <address@hidden> writes:
> attached a org-table-import.patch
Thanks for this patch.
I test it against latest master and got this error:
,----
| Debugger entered--Lisp error: (wrong-type-argument stringp nil)
| re-search-forward(nil #<marker at 57 in tst.org> t)
| (while (re-search-forward separator end t) (replace-match " | " t t))
| (let* ((beg (min beg0 end0)) (end (copy-marker (max beg0 end0))) (separator
(cond ((and separator (stringp separator)) separator) ((eq 4
(prefix-numeric-value separator)) (read-from-minibuffer "Separator char: ")))))
(goto-char beg) (unless separator (setq separator (org-guess-separator)))
(goto-char beg) (while (re-search-forward separator end t) (replace-match " | "
t t)) (goto-char beg) (org-table-align))
| org-table-convert-region(14 57 nil)
| call-interactively(org-table-convert-region t nil)
| execute-extended-command(nil)
| call-interactively(execute-extended-command nil nil)
`----
Beside this problem...
> removes limitations of hard-coded separator char(s).
> `org-guess-separator' accepts and detects all chars as field separators.
> It works based on the assumption, that char looked for appears in equal
> number at each row.
This looks clever, but is it safe? E.g. if cells of the table are
surrounded by double-quotes, you'll have the same number of quotes in
each row, but the double-quote char by itself is _not_ the separator.
So I'm not sure about this heuristics -- want to ear/test more.
> Also a default value
> `org-table-import-default-separator' should make
> guessing faster in some cases.
That an easier way and I would favor it: keep the current behavior,
but add an option for a list of separators that the user can set.
Org would then test this list sequentially.
What do you think?
--
Bastien
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [O] limitations of hard-coded field separator removed,
Bastien <=