;;; context.el --- Support for ConTeXt documents.
-;; Copyright (C) 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Free Software
+;; Foundation, Inc.
;; Maintainer: Berend de Boer <berend@pobox.com>
;; Keywords: tex
(require 'tex-buf)
(require 'tex)
-;; need functions like TeX-look-at and LaTeX-split-long-menu
-(require 'latex)
+(require 'latex) ; for functions like `TeX-look-at' and `LaTeX-split-long-menu'
+(require 'plain-tex) ; for `plain-TeX-common-initialization'
(defgroup ConTeXt-macro nil
"Special support for ConTeXt macros in AUCTeX."
(defvar ConTeXt-item-list ()
"List of macro's considered items.")
-(defvar ConTeXt-extra-paragraph-commands
- '("crlf" "par")
- "List of ConTeXt macros that should have their own line besides the section(-block) commands.")
-
(defun ConTeXt-paragraph-commands-regexp ()
"Return a regexp matching macros that should have their own line."
(concat
(defvar ConTeXt-indent-arg 2)
(defvar ConTeXt-indent-basic 2)
(defvar ConTeXt-indent-item ConTeXt-indent-basic)
-(defvar ConTeXt-indent-item-re "\\\\\item\\>")
+(defvar ConTeXt-indent-item-re "\\\\\\(item\\|sym\\)\\>")
(defvar ConTeXt-indent-syntax-table (make-syntax-table TeX-mode-syntax-table)
"Syntax table used while computing indentation.")
(defun ConTeXt-expand-options ()
"Expand options for texexec command."
(concat
- (let ((engine (nth 4 (assq TeX-engine (TeX-engine-alist)))))
+ (let ((engine (eval (nth 4 (assq TeX-engine (TeX-engine-alist))))))
(when engine
(format "--engine=%s " engine)))
(unless (eq ConTeXt-current-interface "en")
;; They are mapped to interface specific variables
(defvar ConTeXt-language-variable-list
- '(ConTeXt-define-list ConTeXt-setup-list ConTeXt-referencing-list ConTeXt-other-macro-list
- ConTeXt-project-structure-list
- ConTeXt-section-block-list ConTeXt-section-list
- ConTeXt-text ConTeXt-item-list))
+ '(ConTeXt-define-list
+ ConTeXt-setup-list
+ ConTeXt-referencing-list
+ ConTeXt-other-macro-list
+ ConTeXt-project-structure-list
+ ConTeXt-section-block-list
+ ConTeXt-section-list
+ ConTeXt-text
+ ConTeXt-item-list
+ ConTeXt-extra-paragraph-commands))
(defcustom ConTeXt-clean-intermediate-suffixes
;; See *suffixes in texutil.pl.
:type '(repeat regexp)
:group 'TeX-command)
+(TeX-abbrev-mode-setup context-mode)
+
(defun ConTeXt-mode-common-initialization ()
"Initialization code that is common for all ConTeXt interfaces."
;; `plain-TeX-common-initialization' kills all local variables, but
(setq ConTeXt-current-interface save-ConTeXt-current-interface))
(setq major-mode 'context-mode)
+ (setq local-abbrev-table context-mode-abbrev-table)
+
;; Make language specific variables buffer local
(dolist (symbol ConTeXt-language-variable-list)
(make-variable-buffer-local symbol))
(set symbol (symbol-value (intern (concat (symbol-name symbol) "-"
ConTeXt-current-interface)))))
+ ;; Create certain regular expressions based on language
+ (setq ConTeXt-indent-item-re (concat "\\\\\\(" (mapconcat 'identity ConTeXt-item-list "\\|") "\\)\\>"))
;; What's the deepest level at we can collapse a document?
;; set only if user has not set it. Need to be set before menu is created.