From: Kyle Meyer <email@example.com> To: Pankaj Jangid <firstname.lastname@example.org> Cc: email@example.com Subject: Re: Transforming table and then exporting as CSV Date: Sat, 01 May 2021 13:41:05 -0400 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <email@example.com> Pankaj Jangid writes: [...] > Same org file has multiple tables, so I am asking for “Table Name”. 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="(enet-export \"APR2021\")" > --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 ...)))
next prev parent reply other threads:[~2021-05-01 17:42 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-29 15:01 Pankaj Jangid 2021-05-01 17:41 ` Kyle Meyer [this message] 2021-05-03 13:55 ` Pankaj Jangid
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: Transforming table and then exporting as CSV' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
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).