Hi, in the meantime, here is a (somehow egoistic?) patch that adds the latex keyworks I need
Best, /PA On Sat, 12 Apr 2025 at 18:56, Ihor Radchenko <yanta...@posteo.net> wrote: > Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes: > > > So, maybe we should include > > '(require ox-latex) > > in pcomplete to get the LaTeX keywords > > I do not think so. > If we were to do it, we would also need to load all other export > backends. And that would entitle loading all export backends on startup. > Startup is already way too slow. > > > ... or a *new* > > #+STARTUP: latex > > to load ox-latex, right? > > #+STARTUP: beamer is there to automatically load org-beamer-mode. > Imaginary #+STARTUP: latex would not be equivalent - there is no such > thing as org-latex-mode. > > And I generally do not feel like it is a good idea to overload #+STARTUP > even further. > > Maybe we can implement some kind of autoloading mechanism for completion > akin `help-enable-autoload'. That would be cleaner. Patches would be > welcome. > > -- > Ihor Radchenko // yantar92, > Org mode maintainer, > Learn more about Org mode at <https://orgmode.org/>. > Support Org development at <https://liberapay.com/org-mode>, > or support my work at <https://liberapay.com/yantar92> > -- Fragen sind nicht da, um beantwortet zu werden, Fragen sind da um gestellt zu werden Georg Kreisler Sagen's Paradeiser, write BE! Year 1 of the New Koprocracy
From 1ef2b0a999dd01680275c51039daaeb9238bdfe4 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" <paag...@gmail.com> Date: Sat, 12 Apr 2025 19:03:42 +0200 Subject: [PATCH] pcomplete: factor out and activate latex keywords * lisp/org-pcomplete: org-block-keywords: keep it as a variable instead of computing it in every call to pcomplete/org-mode/file-option. ( pcomplete/org-mode/file-option): import ox-latex to include LaTeX keywords in completion logic --- lisp/org-pcomplete.el | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el index 8fdd96826..f306d55ac 100644 --- a/lisp/org-pcomplete.el +++ b/lisp/org-pcomplete.el @@ -157,6 +157,25 @@ The return value is a string naming the thing at point." (while (setq e (pop list)) (setq res (cons (downcase e) (cons (upcase e) res)))) (nreverse res))) + +;; +(defvar org-block-keywords + (let (block-names) + (dolist (name + '("CENTER" "COMMENT" "EXAMPLE" "EXPORT" "QUOTE" "SRC" + "VERSE") + block-names) + (push (format "END_%s" name) block-names) + (push (concat "BEGIN_" + name + ;; Since language is compulsory in + ;; export blocks source blocks, add + ;; a space. + (and (member name '("EXPORT" "SRC")) " ")) + block-names) + (push (concat "ATTR_" name ": ") block-names)) + block-names) + "The keywords related with the blocks") ;;; Completion API @@ -213,26 +232,14 @@ When completing for #+STARTUP, for example, this function returns (defun pcomplete/org-mode/file-option () "Complete against all valid file options." (require 'org-element) + (require 'ox-latex) (pcomplete-here (org-pcomplete-case-double (append (mapcar (lambda (keyword) (concat keyword " ")) org-options-keywords) (mapcar (lambda (keyword) (concat keyword ": ")) org-element-affiliated-keywords) - (let (block-names) - (dolist (name - '("CENTER" "COMMENT" "EXAMPLE" "EXPORT" "QUOTE" "SRC" - "VERSE") - block-names) - (push (format "END_%s" name) block-names) - (push (concat "BEGIN_" - name - ;; Since language is compulsory in - ;; export blocks source blocks, add - ;; a space. - (and (member name '("EXPORT" "SRC")) " ")) - block-names) - (push (format "ATTR_%s: " name) block-names))) + org-block-keywords (mapcar (lambda (keyword) (concat keyword ": ")) (org-get-export-keywords)))) (substring pcomplete-stub 2))) -- 2.34.1