From: SENS@fasecon.econ.nyu.edu
Newsgroups: comp.text.tex
Subject: AUC TeX and GNU Emacs for OS/2 2.0 (long)
Date: 25 Jul 92 23:14:22 EST
Organization: Info-Tex<==>Comp.Text.Tex Gateway
X-Gateway-Source-Info: Mailing List

Greetings fellow emTeXers,

I don't know how big the set OS/2 /\ emTeX /\ Emacs is (surely it is non
empty!), but here is how I got AUC TeX to work with GNU Emacs and emTeX
for OS/2 2.0, in case any one is interested.  My method is probably crude,
but it works (at least on my machine).  On a 386/25DX with 8M memory and
an all hpfs drive, the speed is quite good.

1. Apply the following patch to auc-tex.el:

------------------------------ cut here ------------------------------
diff -cbB auc-tex.el \Emacs\auctex\auc-tex.el
*** auc-tex.el          Fri Jun 12 20:55:15 1992
--- /Emacs/auctex/auc-tex.el    Fri Jul 24 16:49:28 1992
***************
*** 243,249 ****
    (setq TeX-mode-map (make-sparse-keymap))
    (TeX-define-common-keys TeX-mode-map)
    (define-key TeX-mode-map "\177"     'backward-delete-char-untabify)
!   (define-key TeX-mode-map "\n"       'TeX-terminate-paragraph)
    (define-key TeX-mode-map "\""       'TeX-insert-quote)
    (define-key TeX-mode-map "\e}"      'up-list)
    (define-key TeX-mode-map "\e{"      'TeX-insert-braces)
--- 247,253 ----
    (setq TeX-mode-map (make-sparse-keymap))
    (TeX-define-common-keys TeX-mode-map)
    (define-key TeX-mode-map "\177"     'backward-delete-char-untabify)
!   (define-key TeX-mode-map "\C-j"     'TeX-terminate-paragraph)
    (define-key TeX-mode-map "\""       'TeX-insert-quote)
    (define-key TeX-mode-map "\e}"      'up-list)
    (define-key TeX-mode-map "\e{"      'TeX-insert-braces)
***************
*** 251,257 ****
    (define-key TeX-mode-map "\C-c'"    'TeX-comment-out-paragraph)
    (define-key TeX-mode-map "\C-c:"    'TeX-un-comment-region)
    (define-key TeX-mode-map "\C-c\""   'TeX-un-comment)
!   (define-key TeX-mode-map "\C-c\C-o" 'outline-minor-mode)
    (define-key TeX-mode-map "\C-c\C-b" 'TeX-bold)
    (define-key TeX-mode-map "\C-c\C-i" 'TeX-italic)
    (define-key TeX-mode-map "\C-c\C-s" 'TeX-slanted)
--- 255,261 ----
    (define-key TeX-mode-map "\C-c'"    'TeX-comment-out-paragraph)
    (define-key TeX-mode-map "\C-c:"    'TeX-un-comment-region)
    (define-key TeX-mode-map "\C-c\""   'TeX-un-comment)
!   (define-key TeX-mode-map "\C-c\C-o" 'TeX-cmd-on-region)
    (define-key TeX-mode-map "\C-c\C-b" 'TeX-bold)
    (define-key TeX-mode-map "\C-c\C-i" 'TeX-italic)
    (define-key TeX-mode-map "\C-c\C-s" 'TeX-slanted)
***************
*** 270,298 ****
    (define-key TeX-mode-map "\C-c\C-w" 'TeX-toggle-debug-boxes)
    (define-key TeX-mode-map "\C-c?"    'TeX-mode-help)
    (define-key TeX-mode-map "\C-c!"    'TeX-print)
!   (define-key TeX-mode-map "\e\t"     'TeX-complete-symbol)
!
!   (define-key TeX-mode-map "\C-c$"    'TeX-run-lacheck))

  (if LaTeX-mode-map
      ()
    (setq LaTeX-mode-map (copy-keymap TeX-mode-map))
!   (define-key LaTeX-mode-map "\n"       'reindent-then-newline-and-indent)
    (define-key LaTeX-mode-map "\t"       'LaTeX-indent-line)
!   (define-key LaTeX-mode-map "\M-\r"     'LaTeX-insert-item)
!   (define-key LaTeX-mode-map "\C-c\n"   'TeX-terminate-paragraph)
    (define-key LaTeX-mode-map "\C-c\C-x" 'LaTeX-section)
    (define-key LaTeX-mode-map "\C-c\C-c" 'LaTeX-environment)
    (define-key LaTeX-mode-map "\C-c@"    'LaTeX-bibtex)
    (define-key LaTeX-mode-map "\C-c#"    'LaTeX-makeindex)
!   (define-key LaTeX-mode-map "\M-m"     'LaTeX-math-mode)
!   (define-key LaTeX-mode-map "\M-q"     'LaTeX-format-paragraph)
!   (define-key LaTeX-mode-map "\M-g"     'LaTeX-format-region)
!   (define-key LaTeX-mode-map "\M-s"     'LaTeX-format-section)
!   (define-key LaTeX-mode-map "\M-\C-e"  'LaTeX-mark-environment)
    (define-key LaTeX-mode-map "\C-c\C-f"  'LaTeX-close-environment)
!   (define-key LaTeX-mode-map "\M-\C-x"  'LaTeX-mark-section)
!   (define-key LaTeX-mode-map "\M-\C-q"  'LaTeX-format-environment))

  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; TeX / LaTeX modes
--- 272,298 ----
    (define-key TeX-mode-map "\C-c\C-w" 'TeX-toggle-debug-boxes)
    (define-key TeX-mode-map "\C-c?"    'TeX-mode-help)
    (define-key TeX-mode-map "\C-c!"    'TeX-print)
!   (define-key TeX-mode-map "\e\t"     'TeX-complete-symbol))

  (if LaTeX-mode-map
      ()
    (setq LaTeX-mode-map (copy-keymap TeX-mode-map))
!   (define-key LaTeX-mode-map "\C-j"     'reindent-then-newline-and-indent)
    (define-key LaTeX-mode-map "\t"       'LaTeX-indent-line)
!   (define-key LaTeX-mode-map "\e-\C-m"  'LaTeX-insert-item)
!   (define-key LaTeX-mode-map "\C-\n"    'TeX-terminate-paragraph)
    (define-key LaTeX-mode-map "\C-c\C-x" 'LaTeX-section)
    (define-key LaTeX-mode-map "\C-c\C-c" 'LaTeX-environment)
    (define-key LaTeX-mode-map "\C-c@"    'LaTeX-bibtex)
    (define-key LaTeX-mode-map "\C-c#"    'LaTeX-makeindex)
!   (define-key LaTeX-mode-map "\e-m"     'LaTeX-math-mode)
!   (define-key LaTeX-mode-map "\e-q"     'LaTeX-format-paragraph)
!   (define-key LaTeX-mode-map "\e-g"     'LaTeX-format-region)
!   (define-key LaTeX-mode-map "\e-s"     'LaTeX-format-section)
!   (define-key LaTeX-mode-map "\e-\C-e"  'LaTeX-mark-environment)
    (define-key LaTeX-mode-map "\C-c\C-f" 'LaTeX-close-environment)
!   (define-key LaTeX-mode-map "\e-\C-x"  'LaTeX-mark-section)
!   (define-key LaTeX-mode-map "\e-\C-q"  'LaTeX-format-environment))

  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; TeX / LaTeX modes
***************
*** 375,381 ****
    (setq mode-name "TeX")
    (setq major-mode 'plain-TeX-mode)
    (make-local-variable 'TeX-command)
!   (setq TeX-command "tex")
    (setq TeX-bibtex-command "bibtex")
    (setq TeX-index-command "makeindex")
    (setq paragraph-start
--- 375,381 ----
    (setq mode-name "TeX")
    (setq major-mode 'plain-TeX-mode)
    (make-local-variable 'TeX-command)
!   (setq TeX-command "tex386")
    (setq TeX-bibtex-command "bibtex")
    (setq TeX-index-command "makeindex")
    (setq paragraph-start
***************
*** 485,491 ****
    (setq outline-regexp LaTeX-outline-regexp)

    (make-local-variable 'TeX-command)
!   (setq TeX-command "latex")

    (make-local-variable 'TeX-format-package)
    (setq TeX-format-package LaTeX-format-package)
--- 485,491 ----
    (setq outline-regexp LaTeX-outline-regexp)

    (make-local-variable 'TeX-command)
!   (setq TeX-command "tex386")

    (make-local-variable 'TeX-format-package)
    (setq TeX-format-package LaTeX-format-package)
------------------------------ cut here ------------------------------

2. Apply the following patch to tex-buf.el:

------------------------------ cut here ------------------------------
diff -cbB tex-buf.el \Emacs\auctex\tex-buf.el
*** tex-buf.el          Fri Jun 12 21:08:32 1992
--- /Emacs/auctex/tex-buf.el    Fri Jul 24 20:15:10 1992
***************
*** 566,575 ****
    (let ((command (concat TeX-preview-command " " TeX-zap-file ".dvi")))

      (process-kill-without-query
!      (apply 'start-process
!       "preview"
!       "*TeX-output*"
!       (split-string " " command)))

      (with-output-to-temp-buffer "*TeX-output*"
        (princ (format "Started %s; process is \"preview\"\n" command)))))
--- 555,563 ----
    (let ((command (concat TeX-preview-command " " TeX-zap-file ".dvi")))

      (process-kill-without-query
!      (start-process "preview" "*TeX-output*" "cmd"))
!
!     (process-send-string "preview" (concat command  "\n"))

      (with-output-to-temp-buffer "*TeX-output*"
        (princ (format "Started %s; process is \"preview\"\n" command)))))
***************
*** 596,605 ****
      (setq TeX-default-printer-name TeX-printer-name)

      (let ((command (concat TeX-print-command
!              " -P" TeX-printer-name
               (if (not (equal Options ""))
                   (concat " " Options))
!              " " TeX-zap-file ".dvi")))

        (cond ((y-or-n-p (concat "PRINT: "
                   command
--- 585,594 ----
      (setq TeX-default-printer-name TeX-printer-name)

      (let ((command (concat TeX-print-command
!              "" TeX-printer-name
               (if (not (equal Options ""))
                   (concat " " Options))
!              " " TeX-zap-file ".dvi" " " "-po=" TeX-zap-file ".jet")))

        (cond ((y-or-n-p (concat "PRINT: "
                   command
***************
*** 604,614 ****
        (cond ((y-or-n-p (concat "PRINT: "
                   command
                   "  sure? "))
         (setq TeX-process
!          (apply 'start-process
!             "printing"
!             "*TeX-output*"
!             (split-string " " command)))
         (with-output-to-temp-buffer "*TeX-output*"
           (princ (format "Started %s; process is \"printing\"\n" command)))

--- 593,604 ----
        (cond ((y-or-n-p (concat "PRINT: "
                   command
                   "  sure? "))
+
         (setq TeX-process
!          (start-process "printing" "*TeX-output*" "cmd"))
!
!        (process-send-string "printing" (concat command "\n"))
!
         (with-output-to-temp-buffer "*TeX-output*"
           (princ (format "Started %s; process is \"printing\"\n" command)))

------------------------------ cut here ------------------------------

3. Apply the following patch to tex-site.el:

------------------------------ cut here ------------------------------
diff -cbB tex-site.el \Emacs\auctex\tex-site.el
*** tex-site.el         Wed Apr  1 14:47:01 1992
--- /Emacs/auctex/tex-site.el   Thu Jul 23 17:56:15 1992
***************
*** 60,78 ****

  in your .emacs file, to have LaTeX preview as it runs.")

! (defvar TeX-print-command "dvips"
    "*The command to print the .dvi file.")

  (defvar TeX-bibtex-command "bibtex"
    "*The command to run BibTeX")

! (defvar TeX-index-command "makeindex"
    "*The command to run a program generating an index, usually \"makeindex\"")

  (defvar TeX-index-suffix ".ind"
    "*The suffix (file-name-extention) of the file generated by \\[LaTeX-makeindex]")

! (defvar TeX-default-printer-name "lw2"
    "*Name of the printer used by the print-command. Appended to the `-P' option")

  (defvar TeX-compilation-cd-command "cd"
--- 60,78 ----

  in your .emacs file, to have LaTeX preview as it runs.")

! (defvar TeX-print-command "dvihplj @lj.cnf"
    "*The command to print the .dvi file.")

  (defvar TeX-bibtex-command "bibtex"
    "*The command to run BibTeX")

! (defvar TeX-index-command "makeindx"
    "*The command to run a program generating an index, usually \"makeindex\"")

  (defvar TeX-index-suffix ".ind"
    "*The suffix (file-name-extention) of the file generated by \\[LaTeX-makeindex]")

! (defvar TeX-default-printer-name ""
    "*Name of the printer used by the print-command. Appended to the `-P' option")

  (defvar TeX-compilation-cd-command "cd"
***************
*** 157,163 ****
                "xdvi -paper a4r -s 4")

                   ;; else we assume some terminal
!                  (t "dvitty -q -w 160")))

  (setq TeX-preview-a5 (cond
              ;; if we're in OpenWindows2
--- 157,163 ----
                "xdvi -paper a4r -s 4")

                   ;; else we assume some terminal
!                  (t "dvipm @lj.cnf -fl=-1 -o3 -ouin")))

  (setq TeX-preview-a5 (cond
              ;; if we're in OpenWindows2
***************
*** 177,183 ****
               "open")

              ;; else we assume some terminal
!             (t "dvitty -q -w 80")))

  (setq TeX-preview-portrait (cond
                   ;; if we're in OpenWindows2
--- 177,183 ----
               "open")

              ;; else we assume some terminal
!             (t "dvipm  @lj.cnf -fl=-1 -o3 -ouin")))

  (setq TeX-preview-portrait (cond
                   ;; if we're in OpenWindows2
***************
*** 197,203 ****
                "xdvi")

                   ;; else we assume some terminal
!                  (t "dvitty -q -w 80")))

  (defvar TeX-preview-alist
    '(("\\\\documentstyle.*landscape" . TeX-preview-landscape )
--- 197,203 ----
                "xdvi")

                   ;; else we assume some terminal
!                  (t "dvipm @lj.cnf -fl=-1 -o3 -ouin")))

  (defvar TeX-preview-alist
    '(("\\\\documentstyle.*landscape" . TeX-preview-landscape )
------------------------------ cut here ------------------------------

4. Put the following in your .emacs file (see the comments):

------------------------------ cut here ------------------------------
;; make the appropriate change to the path of the AUC TeX files

(setq load-path (cons (expand-file-name "c:/emacs/auctex/") load-path))

(autoload 'tex-mode "auc-tex" "Automatic select TeX or LaTeX mode" t)
(autoload 'plain-tex-mode "auc-tex" "Mode for Plain TeX" t)
(autoload 'latex-mode "auc-tex" "Mode for LaTeX" t)
(autoload 'LaTeX-math-mode    "tex-math"      "Math mode for TeX." t)
(autoload 'outline-minor-mode "outline-minor" "Minor Outline Mode." t)

;; load AUC TeX with the appropriate mode when opning .tex files

(setq auto-mode-alist (append '(("\\.tex$" . tex-mode))
                              auto-mode-alist))

;; use the lplain format for LaTeX files

(setq LaTeX-mode-hook '(lambda()
             (setq TeX-args '("&lplain"))))


(defun Ctl-C-prefix ()                  ; Use Ctl-C as a command prefix
  Ctl-C-keymap)
(setq Ctl-C-keymap (make-keymap))       ; allocate Ctl-C keymap table
(global-set-key "\C-c" (Ctl-C-prefix))  ; define Ctl-C function

(define-key Ctl-C-keymap "m" 'LaTeX-math-mode)
(autoload 'LaTeX-math-mode "tex-math" t)

;;  Setup outline-minor-mode

(define-key Ctl-C-keymap "o" 'outline-minor-mode)
(autoload 'outline-minor-mode "min-out" t)

(make-variable-buffer-local 'outline-prefix-char)
(setq-default outline-prefix-char "\C-l")
(make-variable-buffer-local 'outline-regexp)
(setq-default outline-regexp "[*\^l]+")
(make-variable-buffer-local 'outline-level-function)
(setq-default outline-level-function 'outline-level-default)

;; Personal defaults for AUC-TeX mode, change it to your taste

(setq LaTeX-figure-label "fig:")
(setq LaTeX-table-label "tab:")
(setq LaTeX-section-label "sec:")
(setq LaTeX-default-style "article")
(setq LaTeX-default-style-options "12pt,fleqn")
(setq LaTeX-float "hbtp")
------------------------------ cut here ------------------------------

5. Byte-compile the AUC TeX files and fire up emacs.

6. Become thoroughly spoiled and forget all the LaTeX control sequences.

Note: 1. Auctex documentation says it is available from iesd.auc.dk (and
         possibly elsewhere).  I just copied it from a local Unix machine.
      2. GNU tar, patch and compress for OS/2 are all available from
         hobbes.nmsu.edu (128.123.35.151).
      3. GNU Emacs (a courtsey of E.Mattes and others) is also available
         from hobbes.nmsu.edu.  It can be installed only on an hpfs
         partition (>= 10M), no 8+3 file name nonsense.

Disclaimer: Disclaimers? We don't need no stinkin' disclaimers!

Sincerely,

Sunando Sen
sens@fasecon.econ.nyu.edu
Newsgroups: comp.text.tex