1 ;;; doc.el --- AUCTeX style for `doc.sty'
3 ;; Copyright (C) 2004, 2008 Free Software Foundation, Inc.
5 ;; Author: Frank Küster <frank@kuesterei.ch>
6 ;; Maintainer: auctex-devel@gnu.org
9 ;; This file is part of AUCTeX.
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)
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.
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
28 ;; This file adds support for `doc.sty'.
32 (defun LaTeX-env-no-comment (environment)
33 "Insert ENVIRONMENT and make sure there is no commented empty line inside."
34 (LaTeX-insert-environment environment)
35 (unless (TeX-active-mark)
38 (looking-at (concat "[ \t]+$\\|[ \t]*"
39 TeX-comment-start-regexp "+[ \t]*$")))
40 (delete-region (line-beginning-position) (line-end-position))
41 (indent-according-to-mode))))
43 (defun LaTeX-doc-after-insert-macrocode (env start end)
44 "Make sure the macrocode environment is properly formatted after insertion."
45 (when (TeX-member env '("macrocode" "macrocode*") 'string-equal)
48 (skip-chars-backward " \t")
51 (indent-according-to-mode))
53 (skip-chars-backward " \t")
56 (indent-according-to-mode)))))
62 (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
63 '("macrocode" current-indentation))
64 (add-to-list 'LaTeX-indent-environment-list
65 '("macrocode*" current-indentation))
66 (add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-doc-after-insert-macrocode
68 (LaTeX-add-environments
70 '("macrocode" LaTeX-env-no-comment)
71 '("macrocode*" LaTeX-env-no-comment)
80 '("DescribeMacro" "Macro")
81 '("DescribeEnv" "Environment")
106 "SpecialMainEnvIndex"
123 '("changes" "version" "date (YYYY/MM/DD)")
157 ;; coding: iso-8859-1