Hi Keita, Ikumi Keita <[email protected]> writes:
>>>>>> Arash Esbati <[email protected]> writes: >> Keep in mind that if you want to use in-buffer completion when you're >> inside the brackets, you need `(TeX-arg-key-val key=vals)' in the hook, >> so I think the best would be if you could see if you achieve what you're >> looking after with `LaTeX-env-args' -- but I think that wouldn't work >> because of the (save-excursion ...) it uses? > > My understanding is that `(TeX-arg-key-val key=vals)' is necessary > instead of `TeX-TikZ-env-scope' in > (TeX-add-style-hook > ... > (lambda () > (LaTeX-add-environments > ... > '("scope" TeX-TikZ-env-scope)) > ^^^^^^^^^^^^^^^^^^ > in order for in-buffer completion inside brackets of scope environment > to work. Right? Right. But as always, this is not the whole truth, check the variable `LaTeX-completion-function-map-alist-keyval' :-) > If so, it's yet far beyond ready. I let the future developers of tikz.el > to accomplish that :-) Hmm, and I thought we have that volunteer ;-) Looking at the size of the manual, I wonder if that will ever happen. Maybe using the Digestif LSP-server helps here (which I never used). > Anyway, I'll commit my proposal in a few days unless further comment > arrives from someone. What I described above was that you can probably also use `LaTeX-env-args', here is a test style: --8<---------------cut here---------------start------------->8--- ;; tikz-scope.el for testing -*- lexical-binding: t; -*- (defvar TikZ-scope-key-vals '(("NORMALSIZE" ("true" "false")) ("LARGE" ("true" "false")))) ;; This is the current definition: (defun LaTeX--env-parse-args (args) "Helper function to insert arguments defined by ARGS." (save-excursion (LaTeX-find-matching-begin) (end-of-line) (let ((TeX-exit-mark (or TeX-exit-mark (make-marker)))) (TeX-parse-arguments args)))) ;; This is the supposed definition: (defun LaTeX--env-parse-args (args) "Helper function to insert arguments defined by ARGS." (let ((TeX-exit-mark (or TeX-exit-mark (point-marker)))) (TeX-parse-arguments args) (goto-char (marker-position TeX-exit-mark)) (set-marker TeX-exit-mark nil))) (defun TeX-TikZ-env-scope (_optional) (LaTeX-find-matching-begin) (search-forward TeX-grcl (line-end-position) t) (if (= (following-char) ?\[) (set-marker TeX-exit-mark (1+ (point))) (insert LaTeX-optop LaTeX-optcl) (set-marker TeX-exit-mark (1- (point))))) (TeX-add-style-hook "tikz-scope" (lambda () (LaTeX-add-environments '("scope" LaTeX-env-args [TeX-read-key-val TikZ-scope-key-vals] TeX-TikZ-env-scope)))) --8<---------------cut here---------------end--------------->8--- But this is not possible with the current definition of `LaTeX--env-parse-args'. What do you think about the suggested change? Please don't get me wrong, I'm not insisting on a change of your code, I was just wondering if it's possible to do it with `LaTeX-env-args'. I think we have a bug here which we should fix. Best, Arash
