[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] minted.el: Parsing with `\newminted'
From: |
Arash Esbati |
Subject: |
Re: [AUCTeX-devel] minted.el: Parsing with `\newminted' |
Date: |
Mon, 12 Jan 2015 20:23:07 +0100 |
Hi Mosè,
"Mosè Giordano" <address@hidden> writes:
> I tested this change and it indeed fixes the bug you reported, but
> have you seen the FIXME at line 106? Do you think you can address it
> as well? If not, I'll apply the above patch anyway ;-)
Thanks for testing. I saw that `FIXME' and I thought it was fixed here:
http://git.savannah.gnu.org/cgit/auctex.git/commit/?id=df97f94f70fc159ba8f5de774e1e29062aaac9a1
I assembled a test file:
--8<---------------cut here---------------start------------->8---
\documentclass[a4paper,10pt]{article}
\usepackage[section]{minted}% minted v1.7, 2011/09/17.
% 1a) \newminted{lang}{opts} => new langcode and langcode* envs.
\newminted{cpp}{gobble=2,linenos}
% 1b) \newminted[envname]{lang}{opts} => new envname/envname* envs.
\newminted[CPPTest]{cpp}{gobble=2,linenos}
% 2a) \newmint{foo}{opts} => \foo|code|
\newmint{perl}{showspaces}
% 2b) \newmint[macname]{foo}{opts} => \macname|code|
\newmint[PerlTest]{perl}{showspaces}
\begin{document}
\begin{cpp}
\begin{cpp*}{linenos=false}
1a) & 1b): completion wrong: cppcode is correct
\end{cpp*}
\end{cpp}
\perl|2a) completion works, but AUCTeX doesn't ask for delim|.
\PerlTest|2b) completion works, but AUCTeX doesn't ask for delim|.
\perl[linenos]|This is a valid code.|
\end{document}
--8<---------------cut here---------------end--------------->8---
For review, with the patch below, I get the macros above working as
advertised. What I don't understand are the macros `newmintinline'
and `newmintedfile' which are not in the documentation. OTOH,
`inputminted' is missing in style file while mentioned in doc. I
don't use minted, so maybe Tassilo can clarify here.
--8<---------------cut here---------------start------------->8---
diff --git a/style/minted.el b/style/minted.el
index 83d4764..1eb194c 100644
--- a/style/minted.el
+++ b/style/minted.el
@@ -138,7 +138,7 @@
(dolist (name-lang LaTeX-minted-auto-newminted)
(let* ((env (if (> (length (car name-lang)) 0)
(car name-lang)
- (cadr name-lang)))
+ (concat (cadr name-lang) "code")))
(env* (concat env "*")))
(add-to-list 'LaTeX-auto-environment (list env))
(add-to-list 'LaTeX-auto-environment
@@ -154,7 +154,8 @@
(let ((lang (if (> (length (car name-lang)) 0)
(car name-lang)
(cadr name-lang))))
- (add-to-list 'TeX-auto-symbol lang)
+ (add-to-list 'TeX-auto-symbol ;; \foo[opt]|text| no verb-fontification
anymore
+ `(,lang [ TeX-arg-key-val LaTeX-minted-key-val-options ]
TeX-arg-verb))
(add-to-list 'LaTeX-verbatim-macros-with-delims-local lang)))
;; \newmintinline{foo}{opts} => \fooinline|code|
;; \newmintinline[macname]{foo}{opts} => \macname|code|
--8<---------------cut here---------------end--------------->8---
Best, Arash