GNU bug report logs - #47820
[PATCH] org-table-import: Give option to import interactively even if filename doesn't match

Previous Next

Package: emacs;

Reported by: Utkarsh Singh <utkarsh190601 <at> gmail.com>

Date: Fri, 16 Apr 2021 09:02:02 UTC

Severity: normal

Tags: patch

Done: Bastien <bzg <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47820 in the body.
You can then email your comments to 47820 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#47820; Package emacs. (Fri, 16 Apr 2021 09:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Utkarsh Singh <utkarsh190601 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 16 Apr 2021 09:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Utkarsh Singh <utkarsh190601 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org, emacs-orgmode <at> gnu.org
Subject: [PATCH] org-table-import: Give option to import interactively even
 if filename doesn't match
Date: Fri, 16 Apr 2021 14:31:42 +0530
Hi,

Can we give small flexibility in choosing the filename interactively for
`org-table-import'?  Currently org-table-import will just throw an error
when file name doesn't have .txt, .csv or .tsv as extension.

This patch tries to add a simple yes-and-no to let user choose if they
want to continue importing or not.

diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 0e93fb271f..ab66859d6a 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -938,7 +938,8 @@ org-table-import
 - regexp  When a regular expression, use it to match the separator."
   (interactive "f\nP")
   (when (and (called-interactively-p 'any)
-	     (not (string-match-p (rx "." (or "txt" "tsv" "csv") eos) file)))
+	     (not (string-match-p (rx "." (or "txt" "tsv" "csv") eos) file))
+             (not (yes-or-no-p "File doesn't have .txt, .tsv or .csv as extension.  Do you still want to continue? ")))
     (user-error "Cannot import such file"))
   (unless (bolp) (insert "\n"))
   (let ((beg (point))

-- 
Utkarsh Singh
http://utkarshsingh.xyz




Reply sent to Bastien <bzg <at> gnu.org>:
You have taken responsibility. (Sat, 01 May 2021 08:52:01 GMT) Full text and rfc822 format available.

Notification sent to Utkarsh Singh <utkarsh190601 <at> gmail.com>:
bug acknowledged by developer. (Sat, 01 May 2021 08:52:01 GMT) Full text and rfc822 format available.

Message #10 received at 47820-done <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> gnu.org>
To: Utkarsh Singh <utkarsh190601 <at> gmail.com>
Cc: emacs-orgmode <at> gnu.org, 47820-done <at> debbugs.gnu.org
Subject: Re: bug#47820: [PATCH] org-table-import: Give option to import
 interactively even if filename doesn't match
Date: Sat, 01 May 2021 10:51:00 +0200
Hi Utkarsh,

Utkarsh Singh <utkarsh190601 <at> gmail.com> writes:

> Can we give small flexibility in choosing the filename interactively for
> `org-table-import'?  Currently org-table-import will just throw an error
> when file name doesn't have .txt, .csv or .tsv as extension.

Applied in master as commit 7c99d1555, thanks.

Please see the commit changelog for future patches:
https://code.orgmode.org/bzg/org-mode/commit/7c99d1555

Also https://orgmode.org/worg/org-contribute.html#commit-messages give
more detailed directions.

Thanks,

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47820; Package emacs. (Sat, 01 May 2021 15:15:02 GMT) Full text and rfc822 format available.

Message #13 received at 47820-done <at> debbugs.gnu.org (full text, mbox):

From: Utkarsh Singh <utkarsh190601 <at> gmail.com>
To: Bastien <bzg <at> gnu.org>
Cc: emacs-orgmode <at> gnu.org, 47820-done <at> debbugs.gnu.org
Subject: Re: bug#47820: [PATCH] org-table-import: Give option to import
 interactively even if filename doesn't match
Date: Sat, 01 May 2021 20:44:21 +0530
Hi Bastien,

On 2021-05-01, 10:51 +0200, Bastien <bzg <at> gnu.org> wrote:

> Hi Utkarsh,
>
> Utkarsh Singh <utkarsh190601 <at> gmail.com> writes:
>
>> Can we give small flexibility in choosing the filename interactively for
>> `org-table-import'?  Currently org-table-import will just throw an error
>> when file name doesn't have .txt, .csv or .tsv as extension.
>
> Applied in master as commit 7c99d1555, thanks.
>
> Please see the commit changelog for future patches:
> https://code.orgmode.org/bzg/org-mode/commit/7c99d1555
>
> Also https://orgmode.org/worg/org-contribute.html#commit-messages give
> more detailed directions.

Actually, I proposed a revised patch in the following tread (which also
include more patches building up on this patch):
https://orgmode.org/list/87zgxpwqa7.fsf <at> gmail.com/T/#m38de818718a71f670fbc21b7abb8c789ef485181

Btw, thank you for this and I will try to keep original tread updated
from next time.

-- 
Utkarsh Singh
http://utkarshsingh.xyz




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47820; Package emacs. (Sat, 01 May 2021 16:07:01 GMT) Full text and rfc822 format available.

Message #16 received at 47820-done <at> debbugs.gnu.org (full text, mbox):

From: Bastien <bzg <at> gnu.org>
To: Utkarsh Singh <utkarsh190601 <at> gmail.com>
Cc: 47820-done <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org
Subject: Re: bug#47820: [PATCH] org-table-import: Give option to import
 interactively even if filename doesn't match
Date: Sat, 01 May 2021 18:06:12 +0200
Hi Utkarsh,

Utkarsh Singh <utkarsh190601 <at> gmail.com> writes:

> Actually, I proposed a revised patch in the following tread (which also
> include more patches building up on this patch):
> https://orgmode.org/list/87zgxpwqa7.fsf <at> gmail.com/T/#m38de818718a71f670fbc21b7abb8c789ef485181

thanks for the heads up.  I thought applying this first patch would
help clarify the discussion on this other thread, as the problem is
different.  

I let you and Nicolas move forward on separators guessing, because so
far I'm not really convinved Org should try to be too clever here.

Thanks,

-- 
 Bastien




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47820; Package emacs. (Sat, 01 May 2021 16:51:02 GMT) Full text and rfc822 format available.

Message #19 received at 47820-done <at> debbugs.gnu.org (full text, mbox):

From: Utkarsh Singh <utkarsh190601 <at> gmail.com>
To: Bastien <bzg <at> gnu.org>
Cc: 47820-done <at> debbugs.gnu.org, emacs-orgmode <at> gnu.org
Subject: Re: bug#47820: [PATCH] org-table-import: Give option to import
 interactively even if filename doesn't match
Date: Sat, 01 May 2021 22:20:55 +0530
On 2021-05-01, 18:06 +0200, Bastien <bzg <at> gnu.org> wrote:

> I let you and Nicolas move forward on separators guessing, because so
> far I'm not really convinved Org should try to be too clever here.

Yes! Nicolas has also convinced me on that front.

There was some misunderstanding on my side as I was considering Elisp
(my first Lisp) to be a general purpose language and Org tables it's CSV
library.  Even though due to the very nature of Lisp most of this
possible but Org is not a right place for this.

-- 
Utkarsh Singh
http://utkarshsingh.xyz




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 30 May 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 303 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.