auctex / etc / listings.el

;;; listings.el --- AUCTeX style for `listings.sty'

;; Copyright (C) 2004 Free Software Foundation, Inc.

;; Author: Ralf Angeli <>
;; Maintainer:
;; Created: 2004-10-17
;; Keywords: tex

;; This file is part of AUCTeX.

;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING.  If not, write to the Free
;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.

;;; Commentary:

;; This file adds support for `listings.sty'.
;; FIXME: Please make me more sophisticated!

;;; Code:

 (lambda ()
   ;; New symbols
    '("lstalias" ["Alias dialect"] "Alias" ["Dialect"] "Language")
    '("lstdefinestyle" "Style name" "Arguments (key=value list)")
    '("lstinline" TeX-arg-verb)
    '("lstinputlisting" ["Arguments (key=value list)"] TeX-arg-file)
    '("lstnewenvironment" "Name" ["Number or arguments"] ["Default argument"]
      "Starting code" "Ending code")
   ;; New environments
   ;; Filling
   (make-local-variable 'LaTeX-verbatim-macros)
   (add-to-list 'LaTeX-verbatim-macros "lstinline")
   (make-local-variable 'LaTeX-indent-environment-list)
   (add-to-list 'LaTeX-indent-environment-list
		'("lstlisting" current-indentation))
   (make-local-variable 'LaTeX-verbatim-regexp)
   (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|lstlisting"))
   ;; Fontification
   (when (and (featurep 'font-latex)
	      (eq TeX-install-font-lock 'font-latex-setup))
     (add-to-list 'font-latex-match-function-keywords-local "lstnewenvironment")
     (add-to-list 'font-latex-match-reference-keywords-local "lstinputlisting")
     (add-to-list 'font-latex-match-textual-keywords-local "lstinline")	; Better
									; idea?
     (add-to-list 'font-latex-match-textual-keywords-local "lstlistoflistings")
     (add-to-list 'font-latex-match-variable-keywords-local "lstalias")
     (add-to-list 'font-latex-match-variable-keywords-local "lstdefinestyle")
     (add-to-list 'font-latex-match-variable-keywords-local "lstset")
     (add-to-list 'font-latex-verbatim-environments-local "lstlisting")
     (add-to-list 'font-latex-verbatim-macros-local "lstinline")
     (add-to-list 'font-latex-verb-like-commands-local "lstinline")
     ;; Tell font-lock about the update.
     (setq font-lock-set-defaults nil)

;;; listings.el ends here
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.