auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-devel] Re: specific developer wanted


From: Ralf Angeli
Subject: [AUCTeX-devel] Re: specific developer wanted
Date: Sat, 23 Aug 2008 18:16:52 +0200

* ivo welch (2008-08-17) writes:

> * if the filename ends in .sltx, then load auctex but execute the 
> following set of modifications:
>
> # becomes the comment character, not %
> $ and % lose their special meanings; they become ordinary characters
> \m{...} has its arguments set as if its math mode.
> \nl is like \\
> \be is like \begin{equation}
> \ee is like \end{equation}
>
> I want indentation and highlighting to work right.  That's it.  It needs 
> to go into my .emacs file, simply because I want it to survive the next 
> auctex release upgrade.

In the mail you privately sent to me the requirements where slightly
different.  The following code should do most of the stuff you asked for
in that mail.  However, I don't think that everything will work
correctly because some things are hardcoded in AUCTeX, e.g. some code is
relying on the % as a comment character.  Also, the code tries not to
overwrite existing variable values.  It rather adds or removes parts.
That's why it looks and probably is a bit hackish.  Let me know (on
list) if something is seriously broken.

(define-derived-mode my-LaTeX-pp-mode TeX-latex-mode "my-LaTeX-pp"
  "Major mode for editing LaTeX files to be preprocessed."
  (modify-syntax-entry ?$ ".")
  (modify-syntax-entry ?% ".")
  (modify-syntax-entry ?# "<")
  (setq comment-start "#"
        TeX-comment-start-regexp "#")
  ;; Get rid of $ font locking.  (\[...\] is hardcoded.)
  (delete (assq ?$ (nth 3 font-lock-defaults)) (nth 3 font-lock-defaults))
  (setq font-lock-set-defaults nil)
  (font-lock-set-defaults))

;; Call my-LaTeX-pp-mode when opening a file with a .stex extension.
(add-to-list 'auto-mode-alist '("\\.stex$" . my-LaTeX-pp-mode))

(eval-after-load "tex"
  '(progn
     ;; Uncomment this if a local variables stanza should be added.
     ;; Problem: It addes the wrong comment prefix.
;;      (setq TeX-one-master (concat TeX-one-master "\\|\\.stex$"))
     (add-to-list 'TeX-file-extensions "stex")))

(eval-after-load "texmathp"
  ;; Recognize \m{...} as math macro.
  '(customize-set-variable 'texmathp-tex-commands
                           (append texmathp-tex-commands
                                   '(("\\m" arg-on) ("math" env-on)))))

(eval-after-load "font-latex"
  '(progn
     ;; Fontify \m{...}.
     (customize-set-variable 'font-latex-match-math-command-keywords
                             (append font-latex-match-math-command-keywords
                                     '(("m" "{"))))
     ;; Fontify \nl instead of \\ and \\*.
     (delete "\\" (cadr (assoc "warning"
                               font-latex-built-in-keyword-classes)))
     (delete "\\*" (cadr (assoc "warning"
                                font-latex-built-in-keyword-classes)))
     (customize-set-variable 'font-latex-match-warning-keywords
                             (append font-latex-match-warning-keywords
                                     '(("nl"))))))

-- 
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]