emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: limitations of hard-coded field separator removed
Date: Tue, 27 Mar 2012 23:44:37 +0200	[thread overview]
Message-ID: <87y5qloh16.fsf@altern.org> (raw)
In-Reply-To: <4F463E61.1060309@easy-emacs.de> ("Andreas Röhler"'s message of "Thu, 23 Feb 2012 14:25:53 +0100")

Hi Andreas,

Andreas Röhler <andreas.roehler@easy-emacs.de> 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

      reply	other threads:[~2012-03-27 23:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 13:25 limitations of hard-coded field separator removed Andreas Röhler
2012-03-27 21:44 ` Bastien [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y5qloh16.fsf@altern.org \
    --to=bzg@gnu.org \
    --cc=andreas.roehler@easy-emacs.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).