Hi Dirk, Dirk Ullrich <dirk.ullr...@posteo.de> writes:
> I have noticed a problem with auto-parsing support for `minted` with > the development version of AUCTeX: Thanks for the report. > If I define a new inline macro via `\newmintedinline`, this defined > macro is not known in an included LaTeX file. Here is a small example: > [...] > If I revert Git commit d962325648fee98d0fab6888e5c01d1761fc4784, this > problem is gone. Can you please apply the attached patch to your local repo and tell if it works as expected? TIA. Best, Arash
diff --git a/style/minted.el b/style/minted.el index 4343cef4..10e2a68a 100644 --- a/style/minted.el +++ b/style/minted.el @@ -255,7 +255,7 @@ Update the variable `LaTeX-minted-style-list' if still nil." (defvar LaTeX-minted-newmint-regexp '("\\\\newmint\\(edfile\\|inline\\|ed\\)?\\(?:\\[\\([^]]+\\)\\]\\)?{\\([^}]+\\)}" - (2 3 1) LaTeX-auto-minted-newmint) + (0 2 3 1) LaTeX-auto-minted-newmint) "Match the arguments of \\newmint* macros from minted package.") (defun LaTeX-minted-auto-prepare () @@ -264,13 +264,13 @@ Update the variable `LaTeX-minted-style-list' if still nil." (defun LaTeX-minted-auto-cleanup () "Process the parsed results from minted package." - (dolist (mint LaTeX-auto-minted-newmint) - (cond ((string= (nth 2 mint) "ed") + (dolist (mint (LaTeX-minted-newmint-list)) + (cond ((string= (nth 3 mint) "ed") ;; \newminted{lang}{opts} => new langcode env. ;; \newminted[envname]{lang}{opts} => new envname env. - (let* ((env (if (string-empty-p (car mint)) - (concat (cadr mint) "code") - (car mint)))) + (let ((env (if (string-empty-p (nth 1 mint)) + (concat (nth 2 mint) "code") + (nth 1 mint)))) (LaTeX-add-environments (list env #'LaTeX-env-args @@ -282,10 +282,10 @@ Update the variable `LaTeX-minted-style-list' if still nil." ;; \fooinline[key=vals]{code} ;; \newmintinline[macname]{foo}{opts} => \macname[key=vals]|code| or ;; \macname[key=vals]{code} - ((string= (nth 2 mint) "inline") - (let ((lang (if (string-empty-p (car mint)) - (concat (cadr mint) "inline") - (car mint)))) + ((string= (nth 3 mint) "inline") + (let ((lang (if (string-empty-p (nth 1 mint)) + (concat (nth 2 mint) "inline") + (nth 1 mint)))) (TeX-add-symbols `(,lang [TeX-arg-key-val (LaTeX-minted-key-val-options)] TeX-arg-verb-delim-or-brace)) @@ -296,10 +296,10 @@ Update the variable `LaTeX-minted-style-list' if still nil." (font-latex-add-keywords `((,lang "[")) 'textual)))) ;; \newmintedfile{foo}{opts} => \foofile[key=vals]{file-name} ;; \newmintedfile[macname]{foo}{opts} => \macname[key=vals]{file-name} - ((string= (nth 2 mint) "edfile") - (let ((lang (if (string-empty-p (car mint)) - (concat (cadr mint) "file") - (car mint)))) + ((string= (nth 3 mint) "edfile") + (let ((lang (if (string-empty-p (nth 1 mint)) + (concat (nth 2 mint) "file") + (nth 1 mint)))) (TeX-add-symbols `(,lang [TeX-arg-key-val (LaTeX-minted-key-val-options)] TeX-arg-file)))) @@ -308,9 +308,9 @@ Update the variable `LaTeX-minted-style-list' if still nil." ;; \newmint[macname]{foo}{opts} => \macname[key=vals]|code| or ;; \macname[key=vals]{code} (t - (let ((lang (if (string-empty-p (car mint)) - (cadr mint) - (car mint)))) + (let ((lang (if (string-empty-p (nth 1 mint)) + (nth 2 mint) + (nth 1 mint)))) (TeX-add-symbols `(,lang [TeX-arg-key-val (LaTeX-minted-key-val-options)] TeX-arg-verb-delim-or-brace)) @@ -321,7 +321,7 @@ Update the variable `LaTeX-minted-style-list' if still nil." (font-latex-add-keywords `((,lang "[")) 'textual)))))) ;; Refresh font-locking so that the verbatim envs take effect only ;; when there are defined shortcuts: - (when (and LaTeX-auto-minted-newmint + (when (and (LaTeX-minted-newmint-list) (fboundp 'font-latex-set-syntactic-keywords) (eq TeX-install-font-lock 'font-latex-setup)) (font-latex-set-syntactic-keywords)))