From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +HaNFw5ftmD2lwAAgWs5BA (envelope-from ) for ; Tue, 01 Jun 2021 18:23:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 4Ij8Eg5ftmAAUgAAB5/wlQ (envelope-from ) for ; Tue, 01 Jun 2021 16:23:42 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AE2EA1F74D for ; Tue, 1 Jun 2021 18:23:41 +0200 (CEST) Received: from localhost ([::1]:33702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lo7B6-0005NI-9I for larch@yhetil.org; Tue, 01 Jun 2021 12:23:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lo7Al-0005NA-DB for emacs-orgmode@gnu.org; Tue, 01 Jun 2021 12:23:19 -0400 Received: from ciao.gmane.io ([116.202.254.214]:54610) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lo7Aj-0008Ci-Hi for emacs-orgmode@gnu.org; Tue, 01 Jun 2021 12:23:19 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lo7Ag-0002dL-H9 for emacs-orgmode@gnu.org; Tue, 01 Jun 2021 18:23:14 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: Re: bug#47885: [PATCH] org-table-import: Make it more smarter for interactive use Date: Tue, 1 Jun 2021 23:23:04 +0700 Message-ID: <899175c5-1547-8c0c-2f16-f089fc74690a@gmail.com> References: <87czuq9958.fsf@gmail.com> <8735vmelfs.fsf@nicolasgoaziou.fr> <87k0oyfj4y.fsf@gmail.com> <87im4h9irn.fsf@nicolasgoaziou.fr> <87zgxpwqa7.fsf@gmail.com> <875z07jx6n.fsf@nicolasgoaziou.fr> <87tunqby9a.fsf@gmail.com> <875yzq77w8.fsf@gmail.com> <87o8dd74dv.fsf@gmail.com> <874kf49x7f.fsf@gnu.org> <87pmxse29o.fsf@gmail.com> <87a6ouj5c8.fsf@bzg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 In-Reply-To: <87a6ouj5c8.fsf@bzg.fr> Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.613, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bastien , Utkarsh Singh Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622564622; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=N6UZX8Yq44VbbHPmXwMGQU2LYttKu+3tM5P2WbPxWao=; b=aespKQmGBfY/npDmWK/l3Yy4pnaQdIKNfgcLZqTpH426X3Lxk7JuFRPwsALsZEAkMqtC+R y75ABQFIA9BFeD3TEu3V/Y9zDGdQ48XXUJuTv3bkmrPLu5X82oqLwYDc1IAU4OINlQ/zLM 3KFoDEGLSZ0agR2Pi7pXX7X1dNR8BCYFtqZzclg5l2PHxxIopP2oGXH9zfF5c++Q7F8fQu hdgpjbi1d2a6xoIeGofBuSngyavz4h0FNVRQspQyqSrvimKlzfUUzG48AyLdu/qX5G5r4y /6S3SX3S8nleeg8mSzAukA1pYtN1DeMJpl7p65G0jLz6fVNt7upje+gzdy+YDQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622564622; a=rsa-sha256; cv=none; b=ZEIfYpbziUJ4QXOR5hyejG1OrULtWbTXoTFLTafHCwAWQE/lQHB8MuranHhxX1EReVonEd GcU+ijFo4ihsztR1IVWTZLP6F/H4oBLJia3V2vEtsPbxCHumrKmPc0T2V08uiXovOi9RM+ h4Gs8nU8lD27Fz2N5yquiyuxuYTuc1p1lSH8X+UzHyqm2P9dKYWF+P4/qwXS9J28FpLPKm OQGvH4mQW/PlLVXvSNWmA/mnKm3zPxHOShBRAQS9iOZhfND5b0toiQfmAfiM52O0tYDiLh YXeTSBYjPyUFvjoJusoTr/a/mGcBECnIP/DG82eRaNfF1QtgO6/iTBZhUJjC5g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.83 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: AE2EA1F74D X-Spam-Score: -1.83 X-Migadu-Scanner: scn0.migadu.com X-TUID: Z9ZwVHl7X7NE On 17/05/2021 12:29, Bastien wrote: > Utkarsh Singh writes: >> For now can you review the patches I proposed earlier in this >> thread? > > Not until both you and Maxim are confident this is useful, complete > and predictable. I have too many points to object to consider my opinion as objective. I am unsure if colon as a separator (passwd "db") is widely used case. I was surprised that it is impossible to implement locale-aware detection of semicolon as separator due to limitations of Emacs that is not friendly in respect to internationalization of number formatting. Bastien, I do not know how much tests you prefer to have in Org. Nicolas asked for extensive tests https://orgmode.org/list/875z07jx6n.fsf@nicolasgoaziou.fr I think, before starting work on tests, it is necessary to decide if the patches are acceptable in general. Personally, I have realized that I would prefer to have anything related to CSV (besides very basic features) in a dedicated package, e.g. in csv-mode. It might define a special yank handler for copy-paste to org-mode. Unsure if the author of csv-mode agrees with my point of view. Another option is to pass files through python code to take advantage of more advanced heuristics. On 15/05/2021 18:09, https://orgmode.org/list/87im3kdzi5.fsf@gmail.com Utkarsh Singh wrote: > --- a/lisp/org-table.el > +++ b/lisp/org-table.el > @@ -954,7 +954,8 @@ lines. It can have the following values: > - (64) Prompt for a regular expression as field separator. > - integer When a number, use that many spaces, or a TAB, as field separator. > - regexp When a regular expression, use it to match the separator." > - (interactive "f\nP") > + (interactive (list (read-file-name "Import file: ") > + (prefix-numeric-value current-prefix-arg))) > (when (and (called-interactively-p 'any) Sending patches, I am afraid to break something I was not aware about. I have read docstrings for the modified functions and tried to import the following file "tbl.csv" with some CSV features. LibreOffice imports it correctly, it even normalizes 66.3e-35 to 6.63e-34 (I can not say that I always appreciate such silent modifications). 1,Word,66.3e-35 2,Unquoted cell,2.7 3,"Quoted cell",3.14 4,"Cell ""with quotes""",2021-06-01 5,"Next cell is empty","" 6,"Cell with new Line",6.28 My optimistic expectation was (OK, I did not believe I got such result): | 1 | Word | 66.3e-35 | | 2 | Unquoted cell | 2.7 | | 3 | Quoted cell | 3.14 | | 4 | Cell "with quotes" | 2021-06-01 | | 5 | Next cell is empty | | | 6 | Cell with new | 6.28 | | | Line | | Org 9.1.9 M-x org-table-import and C-u M-x org-table-import actual results are close enough to my expectations | 1 | Word | 66.3e-35 | | 2 | Unquoted cell | 2.7 | | 3 | Quoted cell | 3.14 | | 4 | Cell "with quotes" | 2021-06-01 | | 5 | Next cell is empty | | | 6 | "Cell with new | | | Line" | 6.28 | | M-x org-table-import RET tbl RET completes file name to tbl.csv Org 9.4.5+patches M-x org-table-import | 1,Word,66.3e-35 | | | | | 2,Unquoted | cell,2.7 | | | | 3,"Quoted | cell",3.14 | | | | 4,"Cell | ""with | quotes""",2021-06-01 | | | 5,"Next | cell | is | empty","" | | 6,"Cell | with | new | | | Line",6.28 | | | | Org 9.4.5+patches C-u M-x org-table-import | 1,Word,66.3e-35 | | 2,Unquoted cell,2.7 | | 3,"Quoted cell",3.14 | | 4,"Cell ""with quotes""",2021-06-01 | | 5,"Next cell is empty","" | | 6,"Cell with new | | Line",6.28 | M-x org-table-import RET tbl RET complains that file name extension is not txt, tsv or csv. So my personal conclusion is that CSV file is imported incorrectly in both cases: with guessed separator and with explicitly requested through prefix argument. Completion works a bit worse too. One more note concerning locale support. On 18/05/2021 22:05, Utkarsh Singh wrote: > On 2021-05-18, 19:31 +0700, Maxim Nikulin wrote: >> The question may be risen in emacs-devel but I am unsure if I will >> participate in discussion. > > Why? I am aware of some problems related to localization but I do not have consistent vision what API emacs should have. I have no idea what information is available in Windows. That is why I expect that discussion may be time consuming while I am not sure that someone will be ready to implement new features.