From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: limitations of hard-coded field separator removed Date: Tue, 27 Mar 2012 23:44:37 +0200 Message-ID: <87y5qloh16.fsf@altern.org> References: <4F463E61.1060309@easy-emacs.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCg5x-0004uR-Oi for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 19:46:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCg5v-0007ji-EO for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 19:46:33 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:50434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCg5v-0007j1-5s for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 19:46:31 -0400 Received: by wibhm17 with SMTP id hm17so5044563wib.0 for ; Tue, 27 Mar 2012 16:46:29 -0700 (PDT) In-Reply-To: <4F463E61.1060309@easy-emacs.de> ("Andreas =?iso-8859-1?Q?R?= =?iso-8859-1?Q?=F6hler=22's?= message of "Thu, 23 Feb 2012 14:25:53 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Andreas =?iso-8859-1?Q?R=F6hler?= Cc: emacs-orgmode Hi Andreas, Andreas Röhler 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 # 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