1 ;;; listings.el --- AUCTeX style for `listings.sty'
3 ;; Copyright (C) 2004, 2005, 2009, 2013 Free Software Foundation, Inc.
5 ;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
6 ;; Maintainer: auctex-devel@gnu.org
10 ;; This file is part of AUCTeX.
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
24 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
29 ;; This file adds support for `listings.sty'.
31 ;; FIXME: Please make me more sophisticated!
35 ;; The following are options taken from chapter 4 of the listings
36 ;; manual (2007/02/22 Version 1.4).
37 (defvar LaTeX-listings-key-val-options
38 '(;; Space and placement
39 ("float" ("t" "b" "p" "h")) ; Support [*] as an optional prefix and that
40 ; tbph are not exclusive.
41 ("floatplacement" ("t" "b" "p" "h"))
45 ("boxpos" ("b" "c" "t"))
47 ("print" ("true" "false"))
51 ("showlines" ("true" "false"))
54 ;; Languages and styles
59 ("printpod" ("true" "false"))
60 ("usekeywordsintag" ("true" "false"))
63 ("makemacrouse" ("true" "false"))
64 ;; Figure out the appearance
80 ;; Getting all characters right
81 ("extendedchars" ("true" "false"))
82 ("inputencoding") ; Could make use of `latex-inputenc-coding-alist'.
83 ("upquote" ("true" "false"))
85 ("showtabs" ("true" "false"))
87 ("showspaces" ("true" "false"))
88 ("showstringspaces" ("true" "false"))
91 ("numbers" ("none" "left" "right"))
93 ("numberfirstline" ("true" "false"))
96 ("numberblanklines" ("true" "false"))
97 ("firstnumber" ("auto" "last")) ; Can also take a number.
101 ("caption") ; Insert braces?
103 ("nolol" ("true" "false"))
104 ("numberbychapter" ("true" "false"))
105 ("captionpos" ("t" "b")) ; Can be a subset of tb.
108 ;; Margins and line shape
112 ("resetmargins" ("true" "false"))
113 ("breaklines" ("true" "false"))
114 ("breakatwhitespace" ("true" "false"))
118 ("breakautoindent" ("true" "false"))
120 ("frame" ("none" "leftline" "topline" "bottomline" "lines" "single"
122 ;; Alternative to the above values. A subset of trblTRBL can be
124 "t" "r" "b" "l" "T" "R" "B" "L"))
125 ("frameround" ("t" "f")) ; The input actually has to be four times {t,f}.
130 ("framexrightmargin")
132 ("framebottommargin")
144 ("columns" ("fixed" "flexible" "fullflexible" "spaceflexible")) ;
145 ; Also supports an optional
146 ; argument with {c,l,r}.
147 ("flexiblecolumns" ("true" "false"))
148 ("keepspaces" ("true" "false"))
150 ("fontadjust" ("true" "false"))
152 ("texcl" ("true" "false"))
153 ("mathescape" ("true" "false"))
158 ;; Interface to fancyvrb
159 ("fancyvrb" ("true" "false"))
162 ;; Language definitions
173 ("sensitive" ("true" "false"))
186 ("morekeywordcomment")
187 ("deletekeywordcomment")
188 ("keywordcommentsemicolon")
189 ("podcomment" ("true" "false"))
190 ;; The following are all options from chapter 5, which are
192 ;; Export of identifiers
195 ("deleteprocnamekeys")
197 ("indexprocnames" ("true" "false"))
198 ;; Hyperlink references
204 ;; Literate programming
205 ("literate") ;; three arguments: replace,replacement text,length
206 ;; LGrind definitions
208 ;; Arbitrary linerange markers
215 ("includerangemarker" ("true" "false"))
216 ;; Multicolumn Listing
218 "Key=value options for listings macros and environments.")
225 '("lstalias" ["Alias dialect"] "Alias" ["Dialect"] "Language")
226 '("lstdefinestyle" "Style name"
227 (TeX-arg-key-val LaTeX-listings-key-val-options))
228 '("lstinline" TeX-arg-verb)
229 '("lstinputlisting" [TeX-arg-key-val LaTeX-listings-key-val-options]
232 '("lstnewenvironment" "Name" ["Number or arguments"] ["Default argument"]
233 "Starting code" "Ending code")
234 '("lstset" (TeX-arg-key-val LaTeX-listings-key-val-options))
235 '("lstloadlanguages" t)
236 ;; 4.17 Short Inline Listing Commands
237 '("lstMakeShortInline" [ "Options" ] "Character")
238 '("lstDeleteShortInline" "Character")
240 "lstgrinddeffile" "lstaspectfiles" "lstlanguagefiles"
241 "lstlistingname" "lstlistlistingname")
244 (LaTeX-add-environments
245 '("lstlisting" LaTeX-env-args
246 [TeX-arg-key-val LaTeX-listings-key-val-options]))
248 (make-local-variable 'LaTeX-indent-environment-list)
249 (add-to-list 'LaTeX-indent-environment-list
250 '("lstlisting" current-indentation))
251 (make-local-variable 'LaTeX-verbatim-regexp)
252 (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|lstlisting"))
253 (add-to-list 'LaTeX-verbatim-environments-local "lstlisting")
254 (add-to-list 'LaTeX-verbatim-macros-with-delims-local "lstinline")
255 (add-to-list 'LaTeX-verbatim-macros-with-braces-local "lstinline")
257 (when (and (fboundp 'font-latex-add-keywords)
258 (fboundp 'font-latex-set-syntactic-keywords)
259 (eq TeX-install-font-lock 'font-latex-setup))
260 (font-latex-add-keywords '(("lstnewenvironment" "{[[{{")) 'function)
261 (font-latex-add-keywords '(("lstinputlisting" "[{")) 'reference)
262 (font-latex-add-keywords '(("lstinline" "[{") ; The second argument should
263 ; actually be verbatim.
264 ("lstlistoflistings" ""))
266 (font-latex-add-keywords '(("lstalias" "{{")
267 ("lstdefinestyle" "{{")
270 ;; For syntactic fontification, e.g. verbatim constructs.
271 (font-latex-set-syntactic-keywords)
272 ;; Tell font-lock about the update.
273 (setq font-lock-set-defaults nil)
274 (font-lock-set-defaults)))
277 (defvar LaTeX-listings-package-options '("draft" "final" "savemem"
279 ;; procnames is mentioned in
282 "Package options for the listings package.")
284 ;;; listings.el ends here