From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eIuIGRSTjWD3xQAAgWs5BA (envelope-from ) for ; Sat, 01 May 2021 19:42:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 0Cg4FRSTjWB/IwAAB5/wlQ (envelope-from ) for ; Sat, 01 May 2021 17:42:44 +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 C18DA15FC5 for ; Sat, 1 May 2021 19:42:43 +0200 (CEST) Received: from localhost ([::1]:59412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lctdZ-0002ac-W3 for larch@yhetil.org; Sat, 01 May 2021 13:42:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lctcF-0002aG-TA for emacs-orgmode@gnu.org; Sat, 01 May 2021 13:41:19 -0400 Received: from out0.migadu.com ([2001:41d0:2:267::]:49920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lctcB-0006Ps-VH for emacs-orgmode@gnu.org; Sat, 01 May 2021 13:41:19 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1619890868; h=from:from: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; bh=oRy7PPKmgvh10vi5HErZzFeonpPxGo6wZtjapoER6hY=; b=HOZ2Zh/ycJQM1DPiRBfx8AB/PnCIakNz355Zung0SiklefpQqAeK9Ekmo1fm/1HvIYNof2 taYNf1Bil739mf6c+CEfQDiBGOdqFWqfxax74JgATs87VIxVkYAQIm2/bQ4oZI/OLYMZFT HOlm1JrEEA7xJnb7SYVpcKt1yRpvTTE198DzINet8NYieKrW1z69wzXJpAGoS3l6XOrfzl Yar2fuIYwpCFLb6GCwTv6Y/r2WpKroWBLSHuQ9WaxnwQpPfmpEaj3k05oiXMmlReMmJM5w EcxaHNB8EwJ3FwFnrqDXptxl/EW2ehJuQgHZeXBMrGfM7feaKj9zmXG1M46iMg== From: Kyle Meyer To: Pankaj Jangid Subject: Re: Transforming table and then exporting as CSV In-Reply-To: References: Date: Sat, 01 May 2021 13:41:05 -0400 Message-ID: <87pmya8i8e.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Auth-User: kyle@kyleam.com Received-SPF: pass client-ip=2001:41d0:2:267::; envelope-from=kyle@kyleam.com; helo=out0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: emacs-orgmode@gnu.org 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=1619890963; 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:dkim-signature; bh=oRy7PPKmgvh10vi5HErZzFeonpPxGo6wZtjapoER6hY=; b=nftBY7lIORWDzouvqweuwon6/bXJQl88LvDoNjdk2DDbfVCJz3tkUH8y/VWt1LnKM3tPUU nvMVhs73YKXMm3YGmNuUSxX/SHXyaNEjn2JHsEMrl0N2t4qK2v6aG8Yl8C356IEq5SrhRd aFyMB9hNHfu8Y6Z/rNnumSltXgiY2nmZMCRGAWiYOQpWFJRQ+bXLAkFkwWZbaZPiJDwfJZ 1EvalFJVCbBCKxqYtsKvpxuNX64NI1atgMB1Mdmv+j2PFJ/zgMESt2Oc+TJZrGX5W5gakz dMR8j9pBHn7BtrD89qjqF/hhNmn9fj1/Uzs2zcncRVmVK0V0Fq0YPbYNqBLL0w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619890963; a=rsa-sha256; cv=none; b=MfN7LZA06yLIg/5MqG0BJa8O3b1vG283fMa4JK6MBNDxLcxcSGibL9urtwL7hSYAwC2o3d aKxizS8GxEyq+lvas157D6lSzBaO7gYEZ+UzNa76iHGmTbkhMcXvL82RTGB+t1LMDd9lvR U6pAYqgcBjYKUaMpJhUDoNuDEr1Xjw9HE62cOH+FJWjx490vVrZpRhoma2yn9wm7TWRPLo yKtMPKXSpbPQQpKotBrbkqgC44B91Qy1O2EpyDEsHjbL82KiEkbb9o4McjY/ScX0tYsbdO 6Ppaen8kkxss8rj4vxjNM6EOltFQF96IVu63J2fDpXrnKYPR++jONpiw7jzvFg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b="HOZ2Zh/y"; 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: -2.66 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b="HOZ2Zh/y"; dmarc=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: C18DA15FC5 X-Spam-Score: -2.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: dRNz4C5nBAoM Pankaj Jangid writes: [...] > Same org file has multiple tables, so I am asking for =E2=80=9CTable Name= =E2=80=9D. I > want to do two improvements: > > 1. When asking for table name, I want to offer all the table names in > the file as completion options. You could collect names with something like (require 'subr-x) (let (names) (org-table-map-tables (lambda () (when-let ((name (org-element-property :name (org-element-at-point))= )) (push name names))) 'quiet) (nreverse names)) and then pass those as the collection to completing-read. > 2. Current table at point as default You could get that with (and (org-at-table-p) (save-excursion (goto-char (org-table-begin)) (org-element-property :name (org-element-at-point)))) and pass that as the default for completing-read. > 3. I want to run the function from command line. Like, > > --8<---------------cut here---------------start------------->8--- > emacs --batch enet_2021_22.org -l enet.el --eval=3D"(enet-export \"APR= 2021\")" > --8<---------------cut here---------------end--------------->8--- > > Do I need to change the (interactive...) part in any way to enable > this? I think that'd be the cleanest way, yes. You could change (interactive "MTable Name: ") into (interactive (list (completing-read ...)))