From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id qCznFsXAu16eIAAA0tVLHw (envelope-from ) for ; Wed, 13 May 2020 09:41:25 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8AWoAtTAu17lKQAAbx9fmQ (envelope-from ) for ; Wed, 13 May 2020 09:41:40 +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 1E99494066D for ; Wed, 13 May 2020 09:41:37 +0000 (UTC) Received: from localhost ([::1]:54582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYntR-0007Jj-O2 for larch@yhetil.org; Wed, 13 May 2020 05:41:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYnt1-0007E6-TB for emacs-orgmode@gnu.org; Wed, 13 May 2020 05:41:11 -0400 Received: from [183.249.138.107] (port=9328 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYnsz-0000na-PH for emacs-orgmode@gnu.org; Wed, 13 May 2020 05:41:11 -0400 Received: by dark.localdomain (Postfix, from userid 1000) id 9E83A242042; Wed, 13 May 2020 17:40:19 +0800 (HKT) References: <87mu6hsgtm.fsf@gmail.com> <87y2q0ynkq.fsf@nicolasgoaziou.fr> <87d079s1qj.fsf@gmail.com> <87imh1tdy1.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: <87imh1tdy1.fsf@nicolasgoaziou.fr> Date: Wed, 13 May 2020 17:40:19 +0800 Message-ID: <87lflwuq9o.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 05:41:02 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.53972050957883]; 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_IN_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; 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.06), 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)[stardiviner.github.io:url,nicolasgoaziou.fr:email]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain,text/x-patch]; FREEMAIL_REPLYTO(0.00)[gmail.com]; HAS_LIST_UNSUB(-0.01)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:+,4:~]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.51.188.17:from]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none] X-TUID: 6jLNER4A1Bty --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Nicolas Goaziou writes: > Hello, > > stardiviner writes: > >> Subject: [PATCH] org-pcomplete.el: improve header arguments completion > > Thank you. Some comments follow. > >> - (while (pcomplete-here >> - '("-n" "-r" "-l" >> - ":cache" ":colnames" ":comments" ":dir" ":eval" ":exports" >> - ":file" ":hlines" ":no-expand" ":noweb" ":results" ":rownames" >> - ":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 >> + (when (boundp lang-headers) (eval lang-headers t))))) > > (when ...) -> (and (bounp lang-headers)) (symbol-value lang-headers) Done. > >> + (while (pcomplete-here >> + (mapcar >> + (lambda (arg) (concat ":" (symbol-name (car arg)))) > > (concat ...) -> (format ":%s" (car arg)) Fixed > >> + headers))))) > > It looks like you dropped the switches "-n", "-r", "-l". > > Also, could you add a few tests in "test-org-pcomplete.el"? Add a test for Babel src block languages and header arguments. I'm wandering how to complete header argument values? Do you have any hints? > > 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=2070232e4b1798725d81edab1dfd7984d41d120e0e 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'. =2D-- lisp/org-pcomplete.el | 16 +++++++++++----- testing/lisp/test-org-pcomplete.el | 17 +++++++++++++++++ 2 files changed, 28 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..4a7184100 100644 =2D-- a/testing/lisp/test-org-pcomplete.el +++ b/testing/lisp/test-org-pcomplete.el @@ -75,6 +75,23 @@ (ert-deftest test-org-pcomplete/keyword () (buffer-string)) t))) =20 +(ert-deftest test-org-pcomplete/src-block () + "Test Babel src block header arguments completion." + (should + (string-prefix-p + "#+begin_src emacs-lisp" + (org-test-with-temp-text "#+begin_src emac" + (pcomplete) + (buffer-string)) + t)) + (should + (string-prefix-p + "#+begin_src emacs-lisp :session" + (org-test-with-temp-text "#+begin_src emacs-lisp :sess" + (pcomplete) + (buffer-string)) + t))) + (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----- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl67wIMUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsNWtAf8CMK64VB3diaSrU0WBXYZwnePvgAR Zzw+nFEMDSgxGtToi6fuwnjVe1yWIg9RIFHln0h1K3Qe9puzbgh8IpKdITkmtdW5 l7KoEls03g+FdrMswgUc5VeHVPwhObu/Z5y8vYr9OVTtNim9XQTrLgzVvMoU3suz 8O0K3RXJ0jCwwonOKEHSGnHfV6zjtDwgsDMhLHfBZaxzebbx/uwiwHuEfkTVwgzR cTV5f7PymwXb9s2FT+2xt42UNPRQdphWQ9uxtadFlEwZkkMl1L5rpaTlNY7cYAli NHUXgNcfp+0WnXM28grmULC6pZFmMx2abgQ2HR9kyqPsWD01cPWwjPnLbQ== =tq8O -----END PGP SIGNATURE----- --==-=-=--