From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 4BlHFKjDvF5vZgAA0tVLHw (envelope-from ) for ; Thu, 14 May 2020 04:06:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ADuxDqjDvF6lCAAA1q6Kng (envelope-from ) for ; Thu, 14 May 2020 04:06:00 +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 158DC941145 for ; Thu, 14 May 2020 04:05:57 +0000 (UTC) Received: from localhost ([::1]:43832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZ588-0001t6-IJ for larch@yhetil.org; Thu, 14 May 2020 00:05:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZ57m-0001rC-L9 for emacs-orgmode@gnu.org; Thu, 14 May 2020 00:05:34 -0400 Received: from [183.249.138.107] (port=9754 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZ57l-0003jR-GU for emacs-orgmode@gnu.org; Thu, 14 May 2020 00:05:34 -0400 Received: by dark.localdomain (Postfix, from userid 1000) id A85E524160B; Thu, 14 May 2020 12:05:26 +0800 (HKT) References: <87mu6hsgtm.fsf@gmail.com> <87y2q0ynkq.fsf@nicolasgoaziou.fr> <87d079s1qj.fsf@gmail.com> <87imh1tdy1.fsf@nicolasgoaziou.fr> <87lflwuq9o.fsf@gmail.com> <87pnb7bwcd.fsf@nicolasgoaziou.fr> User-agent: mu4e 1.4; emacs 28.0.50 From: stardiviner To: Nicolas Goaziou Subject: Re: [RFC] Let Org Mode's completion support all Babel header arguments In-reply-to: <87pnb7bwcd.fsf@nicolasgoaziou.fr> Date: Thu, 14 May 2020 12:05:26 +0800 Message-ID: <87zhab88l5.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 183.249.138.107 (deferred) Received-SPF: softfail client-ip=183.249.138.107; envelope-from=numbchild@gmail.com; helo=dark.localdomain X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/13 23:10:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: 15 X-Spam_score: 1.5 X-Spam_bar: + X-Spam_report: (1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9, RDNS_NONE=0.793, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: , Reply-To: numbchild@gmail.com Cc: Org Mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -0.51 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=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-Scan-Result: default: False [-0.51 / 13.00]; HAS_REPLYTO(0.00)[numbchild@gmail.com]; GENERIC_REPUTATION(0.00)[-0.53952705698333]; DWL_DNSWL_BLOCKED(0.00)[209.51.188.17:from]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; FREEMAIL_FROM(0.00)[gmail.com]; HAS_ATTACHMENT(0.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[]; R_MISSING_CHARSET(2.50)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; RCPT_COUNT_TWO(0.00)[2]; MAILLIST(-0.20)[mailman]; SIGNED_PGP(-2.00)[]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.05), country: US(-0.00), ip: 209.51.188.17(-0.54)]; FROM_NEQ_ENVFROM(0.00)[numbchild@gmail.com,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; URIBL_BLOCKED(0.00)[nicolasgoaziou.fr:email,stardiviner.github.io:url]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain,text/x-patch]; FREEMAIL_REPLYTO(0.00)[gmail.com]; HAS_LIST_UNSUB(-0.01)[]; DNSWL_BLOCKED(0.00)[209.51.188.17:from]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+,4:~]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none] X-TUID: YN+AH16ImYsj --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Nicolas Goaziou writes: > Hello, > > stardiviner writes: > >> Add a test for Babel src block languages and header arguments. > > Thank you. Glad this test is simple to write and passed. > >> I'm wandering how to complete header argument values? Do you have any >> hints? > > You can use, again, `org-babel-common-header-args-w-values' for some > parameters. However, most of them specify `:any', which means the value > can be anything, and, therefore, cannot be completed. I see. Thanks. > > You may want to have a look at `org-lint-wrong-header-value' for an > example on how to treat > >> +(ert-deftest test-org-pcomplete/src-block () >> + "Test Babel src block header arguments completion." > > "source block" instead of "src block". Fixed > >> + (should >> + (string-prefix-p >> + "#+begin_src emacs-lisp" >> + (org-test-with-temp-text "#+begin_src emac" >> + (pcomplete) >> + (buffer-string)) >> + t)) > > You can remove the t Done. > >> + (should >> + (string-prefix-p >> + "#+begin_src emacs-lisp :session" >> + (org-test-with-temp-text "#+begin_src emacs-lisp :sess" >> + (pcomplete) >> + (buffer-string)) >> + t))) > > Ditto. Ditto. I attached the new patch. > > Regards, =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 =20=20=20=20=20=20 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-pcomplete.el-improve-header-arguments-completion.patch Content-Transfer-Encoding: quoted-printable From=205b0e7bb971d1459bc1247ce14bec49d897aa2fa5 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Tue, 12 May 2020 21:44:04 +0800 Subject: [PATCH] org-pcomplete.el: improve header arguments completion * lisp/org-pcomplete.el (pcomplete/org-mode/block-option/src): Make it complete real all available header arguments like command `org-babel-insert-header-arg'. * testing/lisp/test-org-pcomplete.el (test-org-pcomplete/src-block): Test Babel source block language and header arguments completing. =2D-- lisp/org-pcomplete.el | 16 +++++++++++----- testing/lisp/test-org-pcomplete.el | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el index 28b40fadd..65651512a 100644 =2D-- a/lisp/org-pcomplete.el +++ b/lisp/org-pcomplete.el @@ -418,11 +418,17 @@ (defun pcomplete/org-mode/block-option/src () (symbol-plist 'org-babel-load-languages) 'custom-type))))))) =2D (while (pcomplete-here =2D '("-n" "-r" "-l" =2D ":cache" ":colnames" ":comments" ":dir" ":eval" ":exports" =2D ":file" ":hlines" ":no-expand" ":noweb" ":results" ":rownames" =2D ":session" ":shebang" ":tangle" ":tangle-mode" ":var")))) + (let* ((info (org-babel-get-src-block-info 'light)) + (lang (car info)) + (lang-headers (intern (concat "org-babel-header-args:" lang))) + (headers (org-babel-combine-header-arg-lists + org-babel-common-header-args-w-values + (and (boundp lang-headers) (eval lang-headers t))))) + (while (pcomplete-here + (append (mapcar + (lambda (arg) (format ":%s" (symbol-name (car arg)))) + headers) + '("-n" "-r" "-l")))))) =20 (defun pcomplete/org-mode/block-option/clocktable () "Complete keywords in a clocktable line." diff --git a/testing/lisp/test-org-pcomplete.el b/testing/lisp/test-org-pco= mplete.el index e6b0e8a7e..2de4f4934 100644 =2D-- a/testing/lisp/test-org-pcomplete.el +++ b/testing/lisp/test-org-pcomplete.el @@ -75,6 +75,21 @@ (ert-deftest test-org-pcomplete/keyword () (buffer-string)) t))) =20 +(ert-deftest test-org-pcomplete/src-block () + "Test Babel source block header arguments completion." + (should + (string-prefix-p + "#+begin_src emacs-lisp" + (org-test-with-temp-text "#+begin_src emac" + (pcomplete) + (buffer-string)))) + (should + (string-prefix-p + "#+begin_src emacs-lisp :session" + (org-test-with-temp-text "#+begin_src emacs-lisp :sess" + (pcomplete) + (buffer-string))))) + (ert-deftest test-org-pcomplete/link () "Test link completion" (should =2D-=20 2.26.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl68w4YUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsOA5wf/WhhUeasXW/iTySKN0CiZS9xrFRRM DjYVdoDD5SNGJ6VTU97Q7PTVJHeQ83TX5EpuIr5lRthSfOyPXyn1kBkt5j/aetR7 XrUj8xMoFaQGg+SyfZ9nsYiUlrT1x+hXnRzqyqk0K/U/vmeKOtFUU9Bzt0bnWVoJ NO1rZiXTgfqcNRBjxpLNDeNhjzD9wan5K3J1YZlvECwoKPn+wQv6B0tRwLNtszx/ pyRiJ8myXFna6r7lbQlxVGiorOqe8ABfRwopwNiWl4rhbXZo0dRedS1TfhxknQIX SEhpQucfPFvnfhg3yDCuuxBvu5kjgBOIkxNoWqB98XmWZszGwntO/A0HWw== =YOIp -----END PGP SIGNATURE----- --==-=-=--