auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] \verb like macro allowing input on more than one line


From: jfbu
Subject: Re: [AUCTeX] \verb like macro allowing input on more than one line
Date: Thu, 16 Oct 2014 17:37:10 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Le 16/10/2014 16:58, Tassilo Horn a écrit :
jfbu <address@hidden> writes:

I only have now to find why doctex-mode does not react, only
latex-mode, (if I open my .dtx, it defaults to DocTeX mode, where for
some reason the hook above is not executed, I have to do M-x
latex-mode. If I open in a buffer a .tex file, no problem)

Hm, in theory doctex-mode (overridden by AUCTeX with TeX-doctex-mode) is
derived from TeX-latex-mode and should also run its hooks...

It that really doesn't work, try adding

   (add-hook 'docTeX-mode-hook
             #'fjbu/LaTeX-activate-font-lock-for-multiline-verb-macros)

in addition to just LaTeX-mode-hook.

Bye,
Tassilo


Hi Tassilo
There appears to be also
font-latex-doctex-syntactic-keywords

My docTeX-mode problem seems to be solved by the following :


--8<---------------cut here---------------start------------->8---
;; Verbatim macros that may have a newline in their argument

;; NOTE THAT verb AND verb* HAVE BEEN REMOVED FROM
;; LaTeX-verbatim-macros-with-delims via the Customize interface

(defvar jfbu/LaTeX-verbatim-macros-with-delims-local
  '("verb" "verb*" "everb"))

(defun jfbu/LaTeX-activate-font-lock-for-multiline-verb-macros ()
  (add-to-list 'font-latex-syntactic-keywords
               `(,(concat "\\\\\\(?:" (regexp-opt 
jfbu/LaTeX-verbatim-macros-with-delims-local) "\\)"
                          "\\(address@hidden)\\(?:\n\\|.\\)*?"
                          "\\(" (regexp-quote TeX-esc) "*\\)\\(\\1\\)")
                 (1 "\"") (2 ".") (3 "\"")))
   (add-to-list 'font-latex-doctex-syntactic-keywords
               `(,(concat "\\\\\\(?:" (regexp-opt 
jfbu/LaTeX-verbatim-macros-with-delims-local) "\\)"
                          "\\(address@hidden)\\(?:\n\\|.\\)*?"
                          "\\(" (regexp-quote TeX-esc) "*\\)\\(\\1\\)")
                 (1 "\"") (2 ".") (3 "\"")))
   )

(add-hook 'LaTeX-mode-hook
          #'jfbu/LaTeX-activate-font-lock-for-multiline-verb-macros )
--8<---------------cut here---------------end--------------->8---

Best
Jean-François






reply via email to

[Prev in Thread] Current Thread [Next in Thread]