redguardtoo/evil-matchit

Jumping between begin and end of latex environment not working

dominiquedevriese opened this issue · 7 comments

Jumping between begin and end of latex environment using % with evil-matchit enabled is not working for me.

I've briefly debugged a bit and it seems it goes wrong in the call "(when (evilmi-sdk-member keyword evilmi-latex-match-tags)" at evil-matchit-latex.el:58. In the debugger, this call looks as follows and returns nil, which I think is the problem.

evilmi-sdk-member(#("begin" 0 5 (fontified t face (font-lock-keyword-face font-latex-sedate-face))) ((("if[a-zA-Z]+" "if") "else" "fi" "MONOGAMY") ("left" nil "right" "MONOGAMY") ("begin[a-z]+" nil "end[a-z]+") ("begin{[a-z]+}" nil "end{[a-z]+}")))

Hope this helps.

Regards,
Dominique

Could you send me a sample latex, I think it' the regular expression problem. It does work on my simple hello.tex (https://github.com/redguardtoo/hello/blob/master/hello.tex)

Thanks for looking into this.

While trying to put together a sample, I just noticed that I only have it when the file includes environments containing a + in the name. Including sample file.

This means a workaround is to define a copy of the environment with a different name (no +).

Regards,
Dominique

test.tex.zip

NP.

Please note evil-matchit is designed to be as versatile as possible. As said in README, you can tweak evil-matchit-latex, say if you use + in tag name, insert below code into you ~/.emacs,

(eval-after-load 'evil-matchit-latex
  '(progn
     (setq evilmi-latex-regexp "\\\\\\([a-zA-Z]+\\(\{[a-zA-Z]+\}\\)?\\)")
     (setq evilmi-latex-match-tags
           '((("if[a-zA-Z]+" "if") "else" "fi" "MONOGAMY")
             ("left" nil "right" "MONOGAMY")
             ("begin[a-z+]+" nil "end[a-z+]+")
             ("begin\{[a-z+]+\}" nil "end\{[a-z+]+\}")
             ))
     ))

I didn't know that, thanks. But even then, I try to limit the
customizations I have to make in various latex packages because I've found
it hard to maintain large collections of this sort of small modifications.
I would hope there's some general regexp that would cover most legal latex
environment identifiers. I would prefer if you could change the regexp in
such a way in the upstream source, unless of course you have some reason
not to do this...

Regards,
Dominique

2016-04-13 13:52 GMT+02:00 Chen Bin notifications@github.com:

Np.
Please note evil-matchit is designed to as versatile as as possible. As
said in README, you can tweak evil-matchit-latex, say if you use + in tag
name, insert below code int you ~/.emacs,

(eval-after-load 'evil-matchit-latex
'(progn
(setq evilmi-latex-regexp "\([a-zA-Z]+({[a-zA-Z]+})?)")
(setq evilmi-latex-match-tags
'((("if[a-zA-Z]+" "if") "else" "fi" "MONOGAMY")
("left" nil "right" "MONOGAMY")
("begin[a-z+]+" nil "end[a-z+]+")
("begin{[a-z+]+}" nil "end{[a-z+]+}")
))
))


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#68 (comment)

sure. Do you need match some extra tags? Send me samples and I will add it to upstream regex.

Not that I'm currently aware... I will bother you with another github
issue if I run into something else ;)

Thanks!
Dominique

2016-04-13 14:42 GMT+02:00 Chen Bin notifications@github.com:

sure. Do you need match some extra tags? Send me samples and I will add it
to upstream regex.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#68 (comment)

6346825 less picky about latex tags (Chen Bin)