Function: ConTeXt-mode-common-initialization

ConTeXt-mode-common-initialization is a byte-compiled function defined in context.el.

Signature

(ConTeXt-mode-common-initialization)

Documentation

Initialization code that is common for all ConTeXt interfaces.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/context.el
(defun ConTeXt-mode-common-initialization ()
  "Initialization code that is common for all ConTeXt interfaces."
  (plain-TeX-common-initialization)

  (setq-local TeX-style-hook-dialect ConTeXt-dialect)

  (require (intern (concat "context-" ConTeXt-current-interface)))
  (dolist (symbol ConTeXt-language-variable-list)
    (set symbol (symbol-value (intern (concat (symbol-name symbol) "-"
                                              ConTeXt-current-interface)))))

  ;; Moved after `run-mode-hooks'. (bug#65750)
  ;; (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.
  ;; level 2 is "section"
  (or ConTeXt-largest-level
      (setq ConTeXt-largest-level 2))

  ;; Indenting
  (setq-local indent-line-function #'ConTeXt-indent-line)
  (setq-local fill-indent-according-to-mode t)

  ;; Paragraph formatting
  (setq-local LaTeX-syntactic-comments nil)
  ;; Moved after `run-mode-hooks'. (bug#65750)
  ;; (set (make-local-variable 'LaTeX-paragraph-commands-regexp)
  ;;      (ConTeXt-paragraph-commands-regexp))
  (setq-local paragraph-ignore-fill-prefix t)
  (setq-local fill-paragraph-function #'LaTeX-fill-paragraph)
  (setq-local adaptive-fill-mode nil)
  ;; Moved after `run-mode-hooks'. (bug#65750)
  ;; (setq paragraph-start
  ;;       (concat
  ;;        "[ \t]*\\("
  ;;        (ConTeXt-paragraph-commands-regexp) "\\|"
  ;;        "\\$\\$\\|" ; Plain TeX display math
  ;;        "$\\)"))
  (setq paragraph-separate
        (concat
         "[ \t]*\\("
         "\\$\\$" ; Plain TeX display math
         "\\|$\\)"))

  ;; Keybindings and menu
  (setq ConTeXt-menu-changed t)

  ;; FIXME: Isn't `activate-menubar-hook' obsolete?
  (add-hook 'activate-menubar-hook #'ConTeXt-menu-update nil t)

  (setq-local beginning-of-defun-function #'ConTeXt-find-matching-start)
  (setq-local end-of-defun-function       #'ConTeXt-find-matching-stop)

  ;; Outline support
  (require 'outline)
  (setq-local outline-level #'ConTeXt-outline-level)
  (setq-local outline-regexp (ConTeXt-outline-regexp t))
  (make-local-variable 'outline-heading-end-regexp)
  (setq TeX-header-end (ConTeXt-header-end)
        TeX-trailer-start (ConTeXt-trailer-start))

  ;; font switch support
  (setq-local TeX-font-list ConTeXt-font-list)

  ;; imenu support
  (setq-local imenu-create-index-function
              #'ConTeXt-imenu-create-index-function)

  (setq TeX-command-default "ConTeXt")
  (setq TeX-sentinel-default-function #'TeX-ConTeXt-sentinel))