EasyPG 1.07 Released
[packages] / xemacs-packages / auctex / style / fancyvrb.el
1 ;;; fancyvrb.el --- AUCTeX style for `fancyvrb.sty' version 2.8.
2
3 ;; Copyright (C) 2013, 2014, 2016, 2017 Free Software Foundation, Inc.
4
5 ;; Maintainer: auctex-devel@gnu.org
6 ;; Author: Mosè Giordano <mose@gnu.org>
7 ;; Keywords: tex
8
9 ;; This file is part of AUCTeX.
10
11 ;; AUCTeX is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; any later version.
15
16 ;; AUCTeX is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 ;; 02110-1301, USA.
25
26 ;;; Commentary:
27
28 ;; This file adds support for `fancyvrb.sty' version 2.8.
29
30 ;; This style has some capabilities to parse user defined macros,
31 ;; environments and saved blocks with `SaveVerbatim' environments and
32 ;; offer them for completion.  After defining a new macro or
33 ;; environment, hit `C-c C-n' to parse the document.  In case of
34 ;; `SaveVerbatim', a second `C-c C-n' might be necessary.
35
36 ;; The command `\CustomVerbatimEnvironment' is not mentioned in the
37 ;; documenation; hence this command is removed from this style.  Use
38 ;; `\DefineVerbatimEnvironment' for new environments and customize the
39 ;; standard ones with `\RecustomVerbatimEnvironment'.
40
41 ;; The entries in `LaTeX-fancyvrb-key-val-options' cover also some
42 ;; keys which are not mentioned in the manual of the package.
43
44 ;;; Code:
45
46 ;; Needed for auto-parsing.
47 (require 'tex)
48
49 (defvar LaTeX-fancyvrb-key-val-options
50   '(("commentchar" ("none"))
51     ("gobble")
52     ("formatcom")
53     ;; Undocumented key
54     ("formatcom*")
55     ("fontfamily" ("tt" "courier" "helvetica"))
56     ("fontsize"   ("auto" "\\tiny" "\\scriptsize"
57                    "\\footnotesize" "\\small" "\\normalsize"
58                    "\\large" "\\Large" "\\LARGE" "\\huge" "\\Huge"))
59     ("fontshape"  ("auto" "n" "it" "sl" "sc" "scit"))
60     ("fontseries" ("auto" "m" "b" "bx" "sb" "c" "l" "lc"))
61     ("frame" ("none" "leftline" "topline" "bottomline" "lines" "single"))
62     ("framerule")
63     ("framesep")
64     ("rulecolor" ("none"))
65     ("fillcolor" ("none"))
66     ("label" ("none"))
67     ("labelposition" ("none" "topline" "bottomline" "all"))
68     ("numbers" ("none" "left" "right"))
69     ("numbersep")
70     ("firstnumber" ("auto" "last" "integer"))
71     ("stepnumber")
72     ("numberblanklines" ("true" "false"))
73     ("firstline")
74     ("lastline")
75     ("showspaces" ("true" "false"))
76     ("showtabs" ("true" "false"))
77     ("obeytabs" ("true" "false"))
78     ("tabsize")
79     ("baselinestretch" ("auto" "dimension"))
80     ("commandchars" ("none"))
81     ("xleftmargin")
82     ("xrightmargin")
83     ("resetmargins" ("true" "false"))
84     ("hfuzz")
85     ("samepage" ("true" "false"))
86     ("codes")
87     ;; Undocumented key
88     ("codes*")
89     ("defineactive")
90     ;; Undocumented key
91     ("defineactive*")
92     ;; Actually, the following options are used only by the `BVerbatim'
93     ;; environment.
94     ("boxwidth" ("auto" "dimension"))
95     ("baseline" ("b" "c" "t"))
96     ;; The next key applies only to `\SaveVerb' macro.
97     ("aftersave"))
98   "Key=value options for fancyvrb macros and environments.")
99
100 (defvar LaTeX-fancyvrb-key-val-options-local nil
101   "Buffer-local key=value options for fancyvrb macros and environments.
102 This variable is intended for packages like \"fvextra\" which
103 provide new key=values for fancyvrb environments.  New key=values
104 should be appended to this variable.")
105 (make-variable-buffer-local 'LaTeX-fancyvrb-key-val-options-local)
106
107 (defvar LaTeX-fancyvrb-base-macros
108   '("VerbatimInput" "BVerbatimInput" "LVerbatimInput"
109     "SaveVerb" "UseVerb" "Verb")
110   "List of base macros available with fancyvrb package.
111 Starred versions are not included in this list.")
112
113 (defvar LaTeX-fancyvrb-base-environments
114   '("Verbatim" "BVerbatim" "LVerbatim" "SaveVerbatim" "VerbatimOut")
115   "List of base environments available with fancyvrb package.
116 Starred versions are not included in this list.")
117
118 (defvar LaTeX-fancyvrb-key-val-skip-regexp
119   (concat
120    "\\(?:\\[[^][]*"
121      "\\(?:{[^}{]*"
122        "\\(?:{[^}{]*"
123          "\\(?:{[^}{]*}[^}{]*\\)*"
124        "}[^}{]*\\)*"
125      "}[^][]*\\)*"
126    "\\]\\)?")
127   "Helper regexp to skip over an optional argument.")
128
129 ;; Setup for defining new Verbatim commands:
130
131 (TeX-auto-add-type "fancyvrb-macro" "LaTeX")
132
133 (defvar LaTeX-fancyvrb-macro-regexp
134   `(,(concat "\\\\\\(Rec\\|C\\)ustomVerbatimCommand"
135              "[ \t\n\r]*{?[ \t\n\r]*\\\\\\([A-Za-z]+\\)[ \t\n\r]*}?"
136              "[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z]+\\)[ \t\n\r]*}")
137     (2 3 1) LaTeX-auto-fancyvrb-macro)
138   "Matches macros by fancyvrb package.")
139
140 ;; Setup for defining new Verbatim environments:
141
142 (TeX-auto-add-type "fancyvrb-environment" "LaTeX")
143
144 (defvar LaTeX-fancyvrb-environment-regexp
145   `(,(concat "\\\\DefineVerbatimEnvironment"
146              "[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z0-9]+\\)[ \t\n\r]*}"
147              "[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z]+\\)[ \t\n\r]*}")
148     (1 2) LaTeX-auto-fancyvrb-environment)
149   "Matches new environments defined by fancyvrb package.")
150
151 ;; Setup for names in SaveVerb macros:
152
153 (TeX-auto-add-type "fancyvrb-saveverb" "LaTeX")
154
155 (defvar LaTeX-fancyvrb-saveverb-regexp
156   `(,(concat "\\\\SaveVerb"
157              LaTeX-fancyvrb-key-val-skip-regexp
158              "{\\([^}]+\\)}")
159     1 LaTeX-auto-fancyvrb-saveverb)
160   "Match the name under which verbatim text is saved by SaveVerb macro.")
161
162 ;; Setup for names in SaveVerbatim environments:
163
164 (TeX-auto-add-type "fancyvrb-saveverbatim" "LaTeX")
165
166 (defvar LaTeX-fancyvrb-saveverbatim-regexp
167   `(,(concat "\\\\begin{SaveVerbatim}"
168              LaTeX-fancyvrb-key-val-skip-regexp
169              "{\\([^}]+\\)}")
170     1 LaTeX-auto-fancyvrb-saveverbatim)
171   "Match the name under which verbatim text is saved by SaveVerbatim environment.")
172
173 (defun LaTeX-fancyvrb-auto-prepare ()
174   "Clear various LaTeX-auto-fancyvrb-* variables before parsing."
175   (setq LaTeX-auto-fancyvrb-macro        nil
176         LaTeX-auto-fancyvrb-environment  nil
177         LaTeX-auto-fancyvrb-saveverb     nil
178         LaTeX-auto-fancyvrb-saveverbatim nil))
179
180 (defun LaTeX-fancyvrb-auto-cleanup ()
181   "Process parsed elements for fancyvrb package."
182   (LaTeX-fancyvrb-arg-define-macro nil t)
183   (LaTeX-fancyvrb-arg-define-environment nil t))
184
185 (add-hook 'TeX-auto-prepare-hook #'LaTeX-fancyvrb-auto-prepare t)
186 (add-hook 'TeX-auto-cleanup-hook #'LaTeX-fancyvrb-auto-cleanup t)
187 (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
188
189 (defun LaTeX-fancyvrb-arg-define-macro (optional &optional cleanup recustom)
190   "Query and insert a new verbatim macro with fancyvrb package.
191 If OPTIONAL is non-nil, insert the arguments in brackets.  If
192 CLEANUP is non-nil, do not insert any arguments in the buffer and
193 update only various AUCTeX variables for verbatim macros.  If
194 RECUSTOM is non-nil, delete macros from the variable
195 `TeX-symbol-list' before adding the new ones."
196   (let ((new-mac (unless cleanup
197                    (if recustom
198                        (completing-read
199                         (TeX-argument-prompt optional nil "Verbatim macro: \\" t)
200                         (mapcar #'car (apply #'append LaTeX-fancyvrb-macro-list)))
201                      (TeX-read-string
202                       (TeX-argument-prompt optional nil "New verbatim macro: \\" t)))))
203         (base-mac (unless cleanup
204                     (completing-read (TeX-argument-prompt optional nil "Based on macro")
205                                      LaTeX-fancyvrb-base-macros)))
206         (rec-flag (if recustom "Rec" "C")))
207     ;; We are (re-)defining a macro: Insert user queried input and use
208     ;; `LaTeX-add-fancyvrb-macros' on the input
209     (unless cleanup
210       (TeX-argument-insert new-mac optional TeX-esc)
211       (TeX-argument-insert base-mac optional)
212       (TeX-argument-insert
213        (TeX-read-key-val optional LaTeX-fancyvrb-key-val-options-local) optional)
214       (LaTeX-add-fancyvrb-macros `(,new-mac ,base-mac ,rec-flag))))
215   ;;
216   ;; Now run the procdure: Do not use the function
217   ;; `LaTeX-fancyvrb-macro-list' here which will remove dupes from the
218   ;; variable `LaTeX-fancyvrb-macro-list' depending on car; we need
219   ;; the variable as is, hence (apply #'append ...);
220   (dolist (elt (apply #'append LaTeX-fancyvrb-macro-list))
221     (let ((mac-name (nth 0 elt))
222           (base-mac (nth 1 elt))
223           (flag     (nth 2 elt)))
224       ;; If we're Rec-ustomizing, delete the entry first from
225       ;; `TeX-symbol-list':
226       (when (string= flag "Rec")
227         (setq TeX-symbol-list
228               (assq-delete-all (car (assoc mac-name (TeX-symbol-list))) TeX-symbol-list)))
229       ;; Now add the new item: Start with new macros for loading
230       ;; files:
231       (cond ((member base-mac '("VerbatimInput" "BVerbatimInput" "LVerbatimInput"))
232              (TeX-add-symbols
233               `(,mac-name
234                 [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
235                 LaTeX-fancyvrb-arg-file-relative))
236              (when (and (fboundp 'font-latex-add-keywords)
237                         (fboundp 'font-latex-update-font-lock))
238                (font-latex-add-keywords `((,mac-name "[{"))
239                                         'reference)))
240             ;; New macros for saving verbatim text:
241             ((string= base-mac "SaveVerb")
242              (TeX-add-symbols
243               `(,mac-name
244                 [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
245                 (TeX-arg-eval
246                  (lambda ()
247                    (let ((name (TeX-read-string
248                                 (TeX-argument-prompt optional nil "Save name"))))
249                      (LaTeX-add-fancyvrb-saveverbs name)
250                      (format "%s" name))))
251                 TeX-arg-verb))
252              (when (and (fboundp 'font-latex-add-keywords)
253                         (fboundp 'font-latex-update-font-lock))
254                (font-latex-add-keywords `((,mac-name "[{"))
255                                         'textual)))
256             ;; New macros for using previously saved text:
257             ((string= base-mac "UseVerb")
258              (TeX-add-symbols
259               `(,mac-name
260                 (TeX-arg-eval
261                  completing-read
262                  (TeX-argument-prompt optional nil "Saved name")
263                  (LaTeX-fancyvrb-saveverb-list))))
264              (when (and (fboundp 'font-latex-add-keywords)
265                         (fboundp 'font-latex-update-font-lock))
266                (font-latex-add-keywords `((,mac-name "{"))
267                                         'textual)))
268             ;; Anything else is considered as verbatim typesetting macro:
269             (t
270              (TeX-add-symbols
271               `(mac-name
272                 [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
273                 TeX-arg-verb))
274              (add-to-list 'LaTeX-verbatim-macros-with-delims-local mac-name t)
275              (when (and (fboundp 'font-latex-add-keywords)
276                         (fboundp 'font-latex-update-font-lock))
277                (font-latex-add-keywords `((,mac-name "["))
278                                         'textual))))))
279   ;; Update font-lock:
280   (when (and (fboundp 'font-latex-add-keywords)
281              (fboundp 'font-latex-update-font-lock)
282              (eq TeX-install-font-lock 'font-latex-setup))
283     (font-latex-update-font-lock t)))
284
285 (defun LaTeX-fancyvrb-arg-define-environment (optional &optional cleanup)
286   "Query and insert a new verbatim environment with fancyvrb package.
287 If OPTIONAL is non-nil, insert the arguments in brackets.  If
288 CLEANUP is non-nil, do not insert any arguments in the buffer and
289 update only various AUCTeX variables for verbatim environments."
290   (let ((new-env (unless cleanup
291                    (TeX-read-string
292                     (TeX-argument-prompt optional nil "New verbatim environment"))))
293         (base-env (unless cleanup
294                     (completing-read (TeX-argument-prompt optional nil "Based on environment")
295                                      LaTeX-fancyvrb-base-environments))))
296     ;; We are defining a new env: First insert the arguments and the
297     ;; run `LaTeX-add-fancyvrb-environments' on '(new-env base-env).
298     ;; If base-env is SaveVerbatim, run
299     ;; `LaTeX-add-fancyvrb-saveverbatims' on new-env as well.
300     (unless cleanup
301       (TeX-argument-insert (car new-env) optional)
302       (TeX-argument-insert base-env optional)
303       (TeX-argument-insert
304        (TeX-read-key-val optional LaTeX-fancyvrb-key-val-options-local) optional)
305       (LaTeX-add-fancyvrb-environments `(,new-env ,base-env))
306       (when (string= base-env "SaveVerbatim")
307         (LaTeX-add-fancyvrb-saveverbatims new-env)))
308     ;;
309     ;; Now run the procdure:
310     (dolist (elt (LaTeX-fancyvrb-environment-list))
311       (let ((env (car elt))
312             (type (cadr elt)))
313         (cond ((string= type "VerbatimOut")
314                (LaTeX-add-environments
315                 `(,env (lambda (env)
316                          (let ((options (TeX-read-key-val t LaTeX-fancyvrb-key-val-options-local))
317                                (file (TeX-read-string "Output file: ")))
318                            (LaTeX-insert-environment
319                             env
320                             (concat
321                              (unless (zerop (length options))
322                                (concat LaTeX-optop options LaTeX-optcl))
323                              (concat TeX-grop file TeX-grcl))))))))
324               ((string= type "SaveVerbatim")
325                (TeX-auto-add-regexp `(,(concat "\\\\begin{"
326                                                env
327                                                "}"
328                                                LaTeX-fancyvrb-key-val-skip-regexp
329                                                "{\\([^}]+\\)}")
330                                       1 LaTeX-auto-fancyvrb-saveverbatim)))
331               (t
332                ;; Regular verbatim environments have a starred
333                ;; version; so add them here; the non-starred additions
334                ;; to `LaTeX-verbatim-environments-local' and
335                ;; `LaTeX-indent-environment-list' are done outside
336                ;; (cond ...):
337                (LaTeX-add-environments
338                 `(,env LaTeX-env-args
339                        [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]))
340                (LaTeX-add-environments
341                 `(,(concat env "*") LaTeX-env-args
342                   [ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]))
343                (add-to-list 'LaTeX-verbatim-environments-local (concat env "*"))
344                (add-to-list 'LaTeX-indent-environment-list
345                             `(,(concat env "*") current-indentation) t)))
346         ;; These apply for all environments defined:
347         (add-to-list 'LaTeX-verbatim-environments-local env)
348         (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation) t)))
349     ;; Update font-lock:
350     (when (and (fboundp 'font-latex-add-keywords)
351                (fboundp 'font-latex-update-font-lock)
352                (eq TeX-install-font-lock 'font-latex-setup))
353       (font-latex-update-font-lock t))))
354
355 (defun LaTeX-fancyvrb-arg-file-relative (optional)
356   "Query and insert a file name relative to current master file.
357 If OPTIONAL is non-nil, insert the file name in brackets."
358   (TeX-argument-insert
359    (file-relative-name
360     (read-file-name (TeX-argument-prompt optional nil "File"))
361     (TeX-master-directory))
362    optional))
363
364 (TeX-add-style-hook
365  "fancyvrb"
366  (lambda ()
367    (TeX-auto-add-regexp LaTeX-fancyvrb-macro-regexp)
368    (TeX-auto-add-regexp LaTeX-fancyvrb-environment-regexp)
369    (TeX-auto-add-regexp LaTeX-fancyvrb-saveverb-regexp)
370    (TeX-auto-add-regexp LaTeX-fancyvrb-saveverbatim-regexp)
371    (TeX-run-style-hooks
372     "keyval")
373
374    ;; Activate the buffer-local version of key-vals.
375    (setq LaTeX-fancyvrb-key-val-options-local
376          (copy-alist LaTeX-fancyvrb-key-val-options))
377
378    (TeX-add-symbols
379     ;; Verbatim material in footnotes
380     "VerbatimFootnotes"
381     ;; Improved verbatim commands
382     '("Verb" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local] TeX-arg-verb)
383     '("DefineShortVerb" (TeX-arg-eval
384                          TeX-read-string
385                          (TeX-argument-prompt optional nil "Character")
386                          TeX-esc))
387     '("UndefineShortVerb" (TeX-arg-eval
388                            TeX-read-string
389                            (TeX-argument-prompt optional nil "Character")
390                            TeX-esc))
391     ;; Verbatim environments
392     '("fvset" (TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local))
393     ;; Changing individual line formatting
394     "FancyVerbFormatLine"
395     ;; Line numbering
396     "theFancyVerbLine"
397     ;; Selection of lines to print
398     "FancyVerbStartString"
399     "FancyVerbStopString"
400
401     ;; Personalized environments
402     '("DefineVerbatimEnvironment"
403       LaTeX-fancyvrb-arg-define-environment)
404     '("RecustomVerbatimEnvironment"
405       (TeX-arg-eval completing-read
406                     (TeX-argument-prompt optional nil "Verbatim environment")
407                     LaTeX-fancyvrb-base-environments)
408       (TeX-arg-eval completing-read
409                     (TeX-argument-prompt optional nil "Based on environment")
410                     LaTeX-fancyvrb-base-environments)
411       (TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local))
412
413     '("CustomVerbatimCommand"
414       LaTeX-fancyvrb-arg-define-macro)
415     '("RecustomVerbatimCommand"
416       (LaTeX-fancyvrb-arg-define-macro nil t))
417
418     ;; Saving and restoring verbatim text and environments
419     '("SaveVerb"
420       [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local]
421       (TeX-arg-eval
422        (lambda ()
423          (let ((name (TeX-read-string
424                       (TeX-argument-prompt optional nil "Save name"))))
425            (LaTeX-add-fancyvrb-saveverbs name)
426            (format "%s" name))))
427       TeX-arg-verb)
428     '("UseVerb" (TeX-arg-eval
429                  completing-read
430                  (TeX-argument-prompt optional nil "Saved name")
431                  (LaTeX-fancyvrb-saveverb-list)))
432     '("UseVerbatim" (TeX-arg-eval completing-read
433                                   (TeX-argument-prompt optional nil "Saved name")
434                                   (LaTeX-fancyvrb-saveverbatim-list)))
435     '("LUseVerbatim" (TeX-arg-eval completing-read
436                                    (TeX-argument-prompt optional nil "Saved name")
437                                    (LaTeX-fancyvrb-saveverbatim-list)))
438     '("BUseVerbatim" (TeX-arg-eval completing-read
439                                    (TeX-argument-prompt optional nil "Saved name")
440                                    (LaTeX-fancyvrb-saveverbatim-list)))
441
442     ;; Writing and reading verbatim files
443     '("VerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local]
444       LaTeX-fancyvrb-arg-file-relative)
445     '("BVerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local]
446       LaTeX-fancyvrb-arg-file-relative)
447     '("LVerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local]
448       LaTeX-fancyvrb-arg-file-relative))
449
450    (LaTeX-add-environments
451     '("Verbatim" LaTeX-env-args
452       [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
453     '("Verbatim*" LaTeX-env-args
454       [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
455     '("BVerbatim" LaTeX-env-args
456       [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
457     '("BVerbatim*" LaTeX-env-args
458       [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
459     '("LVerbatim" LaTeX-env-args
460       [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
461     '("LVerbatim*" LaTeX-env-args
462       [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
463     '("SaveVerbatim"
464       (lambda (env)
465         (let ((options (TeX-read-key-val t LaTeX-fancyvrb-key-val-options-local))
466               (name (TeX-read-string "Save name: ")))
467           (LaTeX-insert-environment
468            env
469            (concat
470             (unless (zerop (length options))
471               (concat LaTeX-optop options LaTeX-optcl))
472             (concat TeX-grop name TeX-grcl)))
473           (LaTeX-add-fancyvrb-saveverbatims name))))
474     '("VerbatimOut"
475       (lambda (env)
476         (let ((options (TeX-read-key-val t LaTeX-fancyvrb-key-val-options-local))
477               (file (TeX-read-string "Output file: ")))
478           (LaTeX-insert-environment
479            env
480            (concat (unless (zerop (length options))
481                      (concat LaTeX-optop options LaTeX-optcl))
482                    (concat TeX-grop file TeX-grcl)))))))
483
484    (LaTeX-add-counters
485     "FancyVerbLine")
486
487    ;; Filling
488    (add-to-list 'LaTeX-verbatim-environments-local "Verbatim")
489    (add-to-list 'LaTeX-verbatim-environments-local "Verbatim*")
490    (add-to-list 'LaTeX-verbatim-environments-local "BVerbatim")
491    (add-to-list 'LaTeX-verbatim-environments-local "BVerbatim*")
492    (add-to-list 'LaTeX-verbatim-environments-local "LVerbatim")
493    (add-to-list 'LaTeX-verbatim-environments-local "LVerbatim*")
494    (add-to-list 'LaTeX-verbatim-environments-local "SaveVerbatim")
495    (add-to-list 'LaTeX-verbatim-environments-local "VerbatimOut")
496    (make-local-variable 'LaTeX-indent-environment-list)
497    (add-to-list 'LaTeX-indent-environment-list '("Verbatim" current-indentation) t)
498    (add-to-list 'LaTeX-indent-environment-list '("Verbatim*" current-indentation) t)
499    (add-to-list 'LaTeX-indent-environment-list '("BVerbatim" current-indentation) t)
500    (add-to-list 'LaTeX-indent-environment-list '("BVerbatim*" current-indentation) t)
501    (add-to-list 'LaTeX-indent-environment-list '("LVerbatim" current-indentation) t)
502    (add-to-list 'LaTeX-indent-environment-list '("LVerbatim*" current-indentation) t)
503    (add-to-list 'LaTeX-indent-environment-list '("SaveVerbatim" current-indentation) t)
504    (add-to-list 'LaTeX-indent-environment-list '("VerbatimOut" current-indentation) t)
505    (add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb")
506
507    ;; Fontification
508    (when (and (fboundp 'font-latex-add-keywords)
509               (fboundp 'font-latex-update-font-lock)
510               (eq TeX-install-font-lock 'font-latex-setup))
511      (font-latex-add-keywords '(("CustomVerbatimCommand"       "{{{")
512                                 ("RecustomVerbatimCommand"     "{{{")
513                                 ("DefineVerbatimEnvironment"   "{{{")
514                                 ("RecustomVerbatimEnvironment" "{{{")
515                                 ("DefineShortVerb"   "{")
516                                 ("UndefineShortVerb" "{")
517                                 ("fvset"             "{"))
518                               'function)
519      (font-latex-add-keywords '(("VerbatimInput"  "[{")
520                                 ("BVerbatimInput" "[{")
521                                 ("LVerbatimInput" "[{"))
522                               'reference)
523      (font-latex-add-keywords '(("Verb" "[") ; The second argument should
524                                         ; actually be verbatim.
525                                 ("SaveVerb"     "[{")
526                                 ("UseVerb"      "{")
527                                 ("UseVerbatim"  "{")
528                                 ("LUseVerbatim" "{")
529                                 ("BUseVerbatim" "{"))
530                               'textual)
531      ;; Tell font-lock about the update.
532      (font-latex-update-font-lock t)))
533  LaTeX-dialect)
534
535 (defvar LaTeX-fancyvrb-package-options nil
536   "Package options for the fancyvrb package.")
537
538 ;;; fancyvrb.el ends here