Is it possible to autocomplete on FieldReference

I am exploring the possibility of using TexMacs in documentation for technical projects.
I saw the possibility of using EvaluableField, that is very good, though field names to be useful must be descriptive, e.g. not “field1”, more something like “rtp-price-per-1-unit-euro”. Then of course, it would be exremely beneficial to be able to autocomplete (tab-complete) on the field name.
Is that possible ?

My impression is that one has to build the completion command for oneself.
here is an example, from progs/generic/generic-edit.scm

(tm-define (kbd-variant t forwards?)
  (:require (and (not (supports-db?)) (bib-cite-context? t)))
  (with u (current-bib-file #t)
    (with ttxt (tree-ref t (cADr (cursor-path)))
      (if (or (url-none? u) (not ttxt))
          (set-message "No completions" "You must add a bibliography file")
          (custom-complete (tm->tree (citekey-completions u ttxt)))))))

with citekey-completions defined in progs/bibtex/bib-complete.scm.
I think it is a bit of work to write the same for the field names of the scripting fields, but looks possible.

I know that some other forum users know this much better than I do, perhaps you will get better answers.

1 Like