linux-l: Re: XEmacs

Robin S. Socha robin at
So Nov 26 14:00:22 CET 2000

* Jens-Uwe Morawski <morawski at> writes:
> 1. erzeugt die Taste [°/^] auf meiner Tastatur xev nach ein
>    "dead_circumflex", bloß XEmacs kann damit nichts anfangen, 

(defun insert-circumflex ()
  "mg: inserts ^ at cursorposition"
  (insert "^"))

> 2. Habe ich mal im GNU Emacs im LaTeX-Mode gesehen, daß dort ein
>    erweitertes Syntax-HiLi vorhanden war.

(require 'font-latex)

> 3. heißt es, daß Latex-mode unter XEmacs automatisch AUCTeX bedeutet.

;:* Initialise aucTeX
(require 'tex-site)
;:* load TeX-toolbar
(require 'tex-toolbar)
;: Automatically save style information when saving the buffer.
(setq TeX-auto-save t)
;: Parse file after loading it if no style hook is found for it.
(setq TeX-parse-self t)
;; fonts
(require 'font-latex)
;: Maximal length of TeX file that will be parsed.
;(setq-default TeX-auto-parse-length 200)
(setq LaTeX-default-options "a4paper,12pt,german,normalheadings")
;: Default options to documentstyle.
(setq-default TeX-master t)
;:* Toy with the dvi previewer according to paper dimensions
;: Torsten Hilbrich <Torsten.Hilbrich @>
(setq TeX-view-style '(("^a5$" "xdvi -thorough %d -paper a5")
                       ("^landscape$" "xdvi -thorough %d -paper a4r -s 4")
                       ("." "xdvi -thorough %d")))
;:*  RefTeX Minor Mode 
;:* Turn on RefTeX Minor Mode for all LaTeX files
(autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
;: Turn on RefTeX mode.
(autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
;: Make a citation using BibTeX database files.
(autoload 'reftex-citation "reftex-cite" "Make citation" nil)
;: RefTeX is a minor mode with distinct support for \ref, \label and
;: \cite commands in (multi-file) LaTeX documents.
;: Plug-in flags for AUCTeX interface.
 reftex-plug-into-AUCTeX t
;: Non-nil means, re-parse only 1 file when asked to re-parse.
 reftex-enable-partial-scans t
;: Flags governing label insertion.  First flag DERIVE, second flag PROMPT.
 reftex-insert-label-flags (quote (t nil))
;: Non-nil means, point in *toc* buffer will cause other window to follow.
 reftex-toc-follow-mode t
;: Non-nil means, save information gathered with parsing in a file.
 reftex-save-parse-info t
;: Non-nil means, re-parse only 1 file when asked to re-parse.
 reftex-enable-partial-scans t
;: Non-nil means, the varioref macro \vref is used as default.
 reftex-vref-is-default t
;: List of flags governing the label menu makeup.
 reftex-label-menu-flags (quote (t t t t t t t t))
;: Default label alist specifications.  LaTeX should always be the last entry.
 reftex-default-label-alist-entries (quote (Sideways amsmath
      endnotes fancybox floatfig longtable picinpar rotating sidecap
      subfigure supertab wrapfig LaTeX))
      reftex-guess-label-type t)
;: Alist with information on environments for \label-\ref use.
      '((nil ?s nil nil nil ("Kapitel" "Kap." "Abschnitt" "Teil"))
	(nil ?e nil nil nil ("Gleichung" "Gl."))
	(nil ?t nil nil nil ("Tabelle"))
	(nil ?f nil nil nil ("Figur" "Abbildung" "Abb."))
	(nil ?n nil nil nil ("Anmerkung" "Anm."))
	(nil ?i nil nil nil ("Punkt"))))
;: View cross reference of \ref or \cite macro where you click.
(add-hook 'reftex-load-hook
	  '(lambda ()
	     (define-key reftex-mode-map [(shift mouse-2)]
;:* Index support
;;When writing a document with an index you will probably define
;;additional macros which make entries into the index.  Let's look at an
;;     \newcommand{\ix}[1]{#1\index{#1}}
;;     \newcommand{\nindex}[1]{\textit{#1}\index[name]{#1}}
(setq reftex-index-macros
      '(("\\ix{*}" "idx" ?x "" nil)
	("\\nindex{*}" "name" ?n "" nil)
;:* TeX-command-list
(defvar TeX-command-list
  (list (list "TeX" "tex '\\nonstopmode\\input %t'" 'TeX-run-TeX nil t)
	(list "TeX Interactive" "tex %t" 'TeX-run-interactive nil t)
	(list "TeX2HTML" "l2h %s" 'TeX-run-interactive nil t)
	(list "T2H(inline gif)" "l2h %s -e2" 'TeX-run-interactive nil t)
	(list "PDFLaTeX" "pdflatex %t" 'TeX-run-interactive nil t)
	(list "LaTeX" "%l '\\nonstopmode\\input{%t}'"
	      'TeX-run-LaTeX nil t)
	(list "LaTeX Interactive" "%l %t" 'TeX-run-interactive nil t)
	(if (or window-system (getenv "DISPLAY"))
	    (list "View" "%v " 'TeX-run-background nil nil)
	  (list "View" "dvi2tty -q -w 132 %s " 'TeX-run-command t nil))
;	    (list "ViewPS" "/usr11/users/baartman/bin/dvipsgv %d" 'TeX-run-background nil nil)
	    (list "ViewPDF" "acroread %a" 'TeX-run-background nil nil)
	    (list "ViewHTML" "netr %n" 'TeX-run-background nil nil)
	(list "Print" "%p" 'TeX-run-command nil nil)
	(list "Queue" "%q" 'TeX-run-background nil nil)
	(list "File" "dvips %d -o %f " 'TeX-run-command t nil)
	(list "BibTeX" "bibtex %s" 'TeX-run-BibTeX nil nil)
	(list "Index" "makeindex %s" 'TeX-run-command nil t)
	(list "Check" "lacheck %s" 'TeX-run-compile nil t)
	(list "Spell" "<ignored>" 'TeX-run-ispell nil nil)
	(list "Other" "" 'TeX-run-command t t)
	;; Not part of standard TeX.
	(list "Makeinfo" "makeinfo %t" 'TeX-run-compile nil t)
	(list "AmSTeX" "amstex '\\nonstopmode\\input %t'"
	      'TeX-run-TeX nil t))
  "*List of commands to execute on the current document.

Each element is a list, whose first element is the name of the command
as it will be presented to the user.  

The second element is the string handed to the shell after being
expanded. The expansion is done using the information found in

The third element is the function which actually start the process.
Several such hooks has been defined:

TeX-run-command: Start up the process and show the output in a
separate buffer.  Check that there is not two commands running for the
same file.  Return the process object. 

TeX-run-format: As TeX-run-command, but assume the output is created
by a TeX macro package.  Return the process object. 

TeX-run-TeX: For TeX output.

TeX-run-LaTeX: For LaTeX output.

TeX-run-interactive: Run TeX or LaTeX interactively.

TeX-run-BibTeX: For BibTeX output.

TeX-run-compile: Use `compile' to run the process.  

TeX-run-shell: Use `shell-command' to run the process.

TeX-run-discard: Start the process in the background, discarding its

TeX-run-background: Start the process in the background, show output
in other window.

TeX-run-dviout: Special hook for the Japanese dviout previewer for

To create your own hook, define a function taking three arguments: The
name of the command, the command string, and the name of the file to
process.  It might be useful to use TeX-run-command in order to
create an asynchronous process.

If the fourth element is non-nil, the user will get a chance to
modify the expanded string.

The fifth element is obsolete and ignored.")

(add-hook 'LaTeX-mode-hook
 (function (lambda()
	      '("GV" "gv %s.dvi" TeX-run-background t nil))
	      '("Ghostview" "ghostview" TeX-run-background t nil))
;:* Use Templates for all modes, especially handy with LaTeX
;: files reside under ~/.templates/LaTeX or whichever mode you want
;: joerg.schulz @ (Joerg Schulz)
(defvar template-directory "~/.templates/"
  "Directory that contains templates")
(defun templ (p)
  (interactive (list (read-string (concat mode-name "-Template: "))))
  (let (tmpl-file)
    (setq tmpl-file (concat template-directory mode-name "/templ." p))
    (if (file-exists-p tmpl-file)
        (insert-file tmpl-file)
      (message "%s" (concat "'" tmpl-file "' not found")))
;(global-set-key  (kbd "C-f9")
;  'templ)
;:* ISpell-Setup by Michael Deindl <olmur @>
(global-set-key "\M-#"   'ispell-word)
(global-set-key "\C-cim" 'ispell-message)
(global-set-key "\C-cib" 'ispell-buffer)
(global-set-key "\C-cic" 'ispell-change-dictionary)
(global-set-key "\C-cid" '(lambda () "set german dictionary"
                            (ispell-change-dictionary "deutsch8")
(global-set-key "\C-cie" '(lambda () "set english dictionary"
                            (ispell-change-dictionary "english")
;:* Flyspell support
;(defun turn-on-flyspell-mode ()
;  (flyspell-mode 1))
;(add-hook 'LaTeX-mode-hook 'turn-on-flyspell-mode)
;:* Update the time stamp string in the buffer.
(require 'time-stamp)
(add-hook 'write-file-hooks 'time-stamp)
(set 'time-stamp-active t)
(set 'time-stamp-format "%3a %3b %2d %4y %02H:%02M:%02S %f")
(defun return-created-string ()
  "Return a \"Created:\" string."
  (let ((time (current-time-string)))
    (concat "Created at: "
            (substring time 0 20)
            (nth 1 (current-time-zone))
            " "
            (substring time -4) " ")))
(setq auto-insert-alist '(
("\\.tex\\'" . (concat "% " (return-created-string)
 -1 " by " (user-full-name) " on " (system-name)
"\n% Last modified: Time-stamp: <> from "
(user-full-name) " on " (system-name) "\n\n"
% Local Variables:"n%" mode: LaTeX"\n\n%" TeX-master: \"-000\"\n%" End:"))))
;; AUC TeX supports style files for several languages.  Each style file
;; may modify some AUC TeX to better support the language, and will run
;; a language specific hook that will allow you to for example change
;; ispell dictionary, or run code to change the keyboard remapping.
(add-hook 'TeX-language-german-hook
	  (function (lambda () (ispell-change-dictionary "german8"))))
;:* imenu for LaTeX 
(require 'imenu)
(add-hook 'LaTeX-mode-hook '(lambda () (imenu-add-to-menubar "Imenu")))

(add-hook 'LaTeX-mode-hook
	  (function (lambda ()
		      (mic-paren-toggle-matching-quoted-paren 1)
		      (mic-paren-toggle-matching-paired-delimiter 1))))
;:* outl-mouse-minor-mode for all LaTeX files
(defun turn-on-outl-mouse-minor-mode ()
  (outl-mouse-minor-mode 1))
(add-hook 'LaTeX-mode-hook 'turn-on-outl-mouse-minor-mode)
;* TeX-toolbar - nice-looking toolbar avec icons for LaTeX.
(add-hook 'LaTeX-mode-hook 'TeX-install-toolbar)
(add-hook 'LaTeX-mode-hook 
           (lambda () 
             (define-key LaTeX-mode-map [(control f6)]   'TeX-toolbar-run-LaTeX)
             (define-key LaTeX-mode-map [(control f7)]   'TeX-toolbar-file)
             (define-key LaTeX-mode-map [(control f8)]   'TeX-toolbar-run-BibTeX)
             (define-key LaTeX-mode-map [(control f9)]   'TeX-toolbar-preview)
             (define-key LaTeX-mode-map [(control f10)]  'TeX-toolbar-print-default)
	     (define-key LaTeX-mode-map [(control return)]  'footnote)
	     (define-key LaTeX-mode-map [(control f11)]  'my-quote)
             (setq TeX-shell "/bin/bash"))))

Robin S. Socha <>

Mehr Informationen über die Mailingliste linux-l