From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Utkarsh Singh Newsgroups: gmane.emacs.bugs,gmane.emacs.orgmode Subject: bug#47820: [PATCH] org-table-import: Give option to import interactively even if filename doesn't match Date: Fri, 16 Apr 2021 14:31:42 +0530 Message-ID: <8735vqzjpl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17412"; mail-complaints-to="usenet@ciao.gmane.io" To: 47820@debbugs.gnu.org, emacs-orgmode@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 16 11:02:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lXKMc-0004MS-Tg for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Apr 2021 11:02:10 +0200 Original-Received: from localhost ([::1]:50692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXKMc-0001wL-0S for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Apr 2021 05:02:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXKMU-0001w2-Qe for bug-gnu-emacs@gnu.org; Fri, 16 Apr 2021 05:02:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXKMU-00054V-JJ for bug-gnu-emacs@gnu.org; Fri, 16 Apr 2021 05:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lXKMU-0007DJ-HW for bug-gnu-emacs@gnu.org; Fri, 16 Apr 2021 05:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Utkarsh Singh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Apr 2021 09:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47820 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161856371127709 (code B ref -1); Fri, 16 Apr 2021 09:02:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Apr 2021 09:01:51 +0000 Original-Received: from localhost ([127.0.0.1]:40016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lXKMI-0007Cq-PP for submit@debbugs.gnu.org; Fri, 16 Apr 2021 05:01:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:52282) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lXKMF-0007Ci-Ke for submit@debbugs.gnu.org; Fri, 16 Apr 2021 05:01:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXKMF-0001vA-8p; Fri, 16 Apr 2021 05:01:47 -0400 Original-Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:36364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXKMD-0004qg-LT; Fri, 16 Apr 2021 05:01:47 -0400 Original-Received: by mail-pj1-x1036.google.com with SMTP id f2-20020a17090a4a82b02900c67bf8dc69so16005000pjh.1; Fri, 16 Apr 2021 02:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=hAL7QDW7lio+mBqzKbMsJJcb9AJWd5fHYybMn7J12Fk=; b=V+68Xwp9nTKW0LoPC/QroEgpLZrel6KLX1QPKlbN9zQNziLxPmzf8BNtyN3U3inL05 4La+ve74itRA6cQjXuyHH84urUNlkke+1pkLgjvvBrLnnnRzMnHTVVkVTEa9mKa5a/U6 1AJf7bKeZFmOYZKp2EDmjo4alQHtw38n4E30gAkusi15XGoLEmxEGb8FwnJKw7BMlq0J AhjAZfC5OSgEZshgFMFHQVICYP2SjGZXit39GZlDK7rDOfBqwpMt0Xg2sZgX0kimI2Xs iKjBOX8yYergcGf/QzWaepxh3g9oGyacfhP9VGhRZOeAqOIgfx9b/LAe/BpBQdUwBChR 74UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=hAL7QDW7lio+mBqzKbMsJJcb9AJWd5fHYybMn7J12Fk=; b=GrradAdMMwPj9m6DHtU8UmJ8Eex1EVIo4ozXver1aH6hplgMeZPAnf9DNASBd1MoUT b8TKXYAkRi8nUoBxoW/BG2h0pzvuHQzqqKJzRAfprmtffovQ4YFVEKJmj0pfEe6cAdv0 Zxw6An+OKL3xQDqZd/37uD+fq/Tk93FyBCnl8+SDvwH13k2h4C9MwCTsZ5mklsRb3ge7 +gskMw72En11XuqWxdpPZHsqU70FvzmvXGVD73+jPNBkoqENk4D9/GV7suEWgjZH4EFM SW00ljid4/th1KENaiaNLrM5aSW8eDeZu8XCwsvEFjUfPhsY1hlT/FGpaG/5WTYpYqPa 5phA== X-Gm-Message-State: AOAM533p6NjVlBiH6A2dwX4TkJCS4J6r28w35RakT55h5HwYqvNOcHNJ Vg1Im05IGUF0v6L8tL1lSbHmc7RypBs= X-Google-Smtp-Source: ABdhPJxg2VjpS1xVDeeeEPrbqVy8FS4JxKH6ZBj0rVSaKeg/lHa/ruONJNEztneXtUT29xabX7wK5g== X-Received: by 2002:a17:902:20a:b029:eb:873d:d73d with SMTP id 10-20020a170902020ab02900eb873dd73dmr5883359plc.54.1618563701871; Fri, 16 Apr 2021 02:01:41 -0700 (PDT) Original-Received: from localhost ([45.251.50.123]) by smtp.gmail.com with ESMTPSA id c21sm3537459pfc.165.2021.04.16.02.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 02:01:41 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=utkarsh190601@gmail.com; helo=mail-pj1-x1036.google.com X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:204125 gmane.emacs.orgmode:136030 Archived-At: 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