Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > Hello, > > stardiviner <numbch...@gmail.com> writes: > >> I found Org Mode's completion (from ~completion-at-point-functions~ which is >> provided by ~pcomplete-completions-at-point~) can complete in bellowing >> places >> (the "|" represent cursor point): > > [...] > >> So I think Org Mode need an union API to manage those keywords. WDYT? > > pcomplete certainly needs some love. > > There is already `org-babel-common-header-args-w-values' and > `org-babel-header-args:LANG'. You may want to look into > `org-lint-wrong-header-value' to check how they are used. > > Regards,
I found library "org-pcomplete.el" and check it out, I combined the header arguments retrieve mechanism from command ~org-babel-insert-header-arg~. Put it into ~pcomplete/org-mode/block-option/src~. Not org-pcomplete.el on Babel header arguments works perfect. I attached the patch. -- [ 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
From 540f79db180aca95b0e202230c85e592b4fc579c Mon Sep 17 00:00:00 2001 From: stardiviner <numbch...@gmail.com> 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'. --- lisp/org-pcomplete.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el index 28b40fadd..d9c301bd0 100644 --- a/lisp/org-pcomplete.el +++ b/lisp/org-pcomplete.el @@ -418,11 +418,16 @@ (defun pcomplete/org-mode/block-option/src () (symbol-plist 'org-babel-load-languages) 'custom-type))))))) - (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))))) + (while (pcomplete-here + (mapcar + (lambda (arg) (concat ":" (symbol-name (car arg)))) + headers))))) (defun pcomplete/org-mode/block-option/clocktable () "Complete keywords in a clocktable line." -- 2.26.2
signature.asc
Description: PGP signature