jfbu <[email protected]> writes:
Hi Jean-Francois,
> I have a verbatim like macro with delimiters, I call it \everb, which
> contrarily to \verb accepts multi-line input.
>
> I customized variable LaTeX-verbatim-macros-with-delims but the
> font-locking applies only to cases where argument is on one line:
>
> \everb|foo bar| % ok
>
> \everb|foo
> bar| % no font locking
>
> Is there a way do enably font-locking in the latter case?
Not really. I could easily change the relevant regular expression in
font-latex.el so that newlines in `LaTeX-verbatim-macros-with-delims'
would be allowed but I'm not convinced that this is a good idea. All
such macros I know of (\verb, \lstinline, \mintinline or the macros
generated by minted, e.g., \javainline) have to be closed on the same
line. If they were highlighted when their argument spans multiple
lines, it would give a false indication of being correct.
What you can do, however, is something like this:
--8<---------------cut here---------------start------------->8---
;; Verbatim macros that may have a newline in their argument
(defvar fjbu/LaTeX-verbatim-multiline-macros-with-delims-local
'("everb"))
(defun fjbu/LaTeX-activate-font-lock-for-multiline-verb-macros ()
(add-to-list 'font-latex-syntactic-keywords
`(,(concat "\\\\\\(?:"
fjbu/LaTeX-verbatim-multiline-macros-with-delims-local "\\)"
"\\([^a-z@*\n\f{]\\)\\(?:\n\\|.\\)*?"
"\\(" (regexp-quote TeX-esc) "*\\)\\(\\1\\)")
(1 "\"") (2 ".") (3 "\""))))
(add-hook 'LaTeX-mode-hook
#'fjbu/LaTeX-activate-font-lock-for-multiline-verb-macros)
--8<---------------cut here---------------end--------------->8---
HTH,
Tassilo
_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex