emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-table-import: Give option to import interactively even if filename doesn't match
@ 2021-04-16  9:01 Utkarsh Singh
  2021-05-01  8:51 ` bug#47820: " Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Utkarsh Singh @ 2021-04-16  9:01 UTC (permalink / raw)
  To: bug-gnu-emacs, emacs-orgmode

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug#47820: [PATCH] org-table-import: Give option to import interactively even if filename doesn't match
  2021-04-16  9:01 [PATCH] org-table-import: Give option to import interactively even if filename doesn't match Utkarsh Singh
@ 2021-05-01  8:51 ` Bastien
  2021-05-01 15:14   ` Utkarsh Singh
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2021-05-01  8:51 UTC (permalink / raw)
  To: Utkarsh Singh; +Cc: emacs-orgmode, 47820-done

Hi Utkarsh,

Utkarsh Singh <utkarsh190601@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug#47820: [PATCH] org-table-import: Give option to import interactively even if filename doesn't match
  2021-05-01  8:51 ` bug#47820: " Bastien
@ 2021-05-01 15:14   ` Utkarsh Singh
  2021-05-01 16:06     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Utkarsh Singh @ 2021-05-01 15:14 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, 47820-done

Hi Bastien,

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

> Hi Utkarsh,
>
> Utkarsh Singh <utkarsh190601@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@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug#47820: [PATCH] org-table-import: Give option to import interactively even if filename doesn't match
  2021-05-01 15:14   ` Utkarsh Singh
@ 2021-05-01 16:06     ` Bastien
  2021-05-01 16:50       ` Utkarsh Singh
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2021-05-01 16:06 UTC (permalink / raw)
  To: Utkarsh Singh; +Cc: 47820-done, emacs-orgmode

Hi Utkarsh,

Utkarsh Singh <utkarsh190601@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@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug#47820: [PATCH] org-table-import: Give option to import interactively even if filename doesn't match
  2021-05-01 16:06     ` Bastien
@ 2021-05-01 16:50       ` Utkarsh Singh
  0 siblings, 0 replies; 5+ messages in thread
From: Utkarsh Singh @ 2021-05-01 16:50 UTC (permalink / raw)
  To: Bastien; +Cc: 47820-done, emacs-orgmode

On 2021-05-01, 18:06 +0200, Bastien <bzg@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-01 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16  9:01 [PATCH] org-table-import: Give option to import interactively even if filename doesn't match Utkarsh Singh
2021-05-01  8:51 ` bug#47820: " Bastien
2021-05-01 15:14   ` Utkarsh Singh
2021-05-01 16:06     ` Bastien
2021-05-01 16:50       ` Utkarsh Singh

Code repositories for project(s) associated with this 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).