From: rossini@biosun1.harvard.edu (Anthony Rossini)
Newsgroups: alt.lucid-emacs.help
Subject: AucTex modifications
Date: 12 Jan 93 22:27:41 GMT
Distribution: alt
Organization: Biostat Dept, HSPH, Boston MA, USA.


Well - sufficient people asked, so I'm going to post the code.  It was my
first attempt at this type of thing, and it contains a small (1/2 line!)
diff to auc-tex.el, and a new file, auc-tex-lucid.el.  Ideas are shamelessly
stolen from gnus-lucid.el (or whatever the file containing mods in the gnus
package was called).  If you modify it significantly, I'd love to see the
changes, other than that, enjoy!

It's also an acceptable example of how to add menus to an existing package,
for those who have recently asked the question...  (the diff is a switch to
load/require the mouse code, called from the primary start-up for AUC-TeX.

Enjoy!

-tony
------------ cut here ----------- (but beware of sig at the end)

#! /bin/sh
# Strip off top stuff and run this through /bin/sh to produce:
# auc-tex.el.patch
# auc-tex-lucid.el
# Produced by Chris's stupid and simple sh shar.
echo 'auc-tex.el.patch'
if [ -f auc-tex.el.patch ] 
then
  echo auc-tex.el.patch already exists; exit 1
fi
sed 's/^X//' >'auc-tex.el.patch' <<'ENDIT' 
X479,481d478
X<   ;; added by ajr, 102692, for button stuff
X<   (if (string-match "Lucid" emacs-version) (require 'auc-tex-lucid))
X< 
ENDIT
echo 'auc-tex-lucid.el'
if [ -f auc-tex-lucid.el ] 
then
  echo auc-tex-lucid.el already exists; exit 1
fi
sed 's/^X//' >'auc-tex-lucid.el' <<'ENDIT' 
X;;; Mouse support for AUC-TeX version 6.1 running in Lucid (GNU?) Emacs,
X;;; at least for version 19.3.  By Anthony Rossini, rossini@hsph.harvard.edu
X;;; 
X;;; This program is free software; you can redistribute it and/or modify
X;;; it under the terms of the GNU General Public License as published by
X;;; the Free Software Foundation; either version 1, or (at your option)
X;;; any later version.
X;;;
X;;; This program is distributed in the hope that it will be useful,
X;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
X;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X;;; GNU General Public License for more details.
X;;;
X;;; The GNU General Public License is available by anonymouse ftp from
X;;; prep.ai.mit.edu in pub/gnu/COPYING.  Alternately, you can write to
X;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
X;;; USA.
X;;;
X;;; If you modify it in any significant way, I'd appreciate getting a copy
X;;; though it isn't required! :-).
X
X
X(defvar auctex-menu
X  '("AUC-TeX Commands"
X    ["(La)TeX Buffer" TeX-buffer t]
X    ["LaCheck Buffer" TeX-run-lacheck t]
X    ["Kill Compilation" TeX-kill-job t]
X    "----"
X    ["Preview Buffer (need to TeX-buffer first)" TeX-preview t]
X    ["Print Buffer (need to TeX-buffer first)" TeX-print t]
X    ["Spell Buffer" ispell-buffer t]
X    ["BibTeX" LaTeX-bibtex t]
X    "----"
X    ["Toggle Math mode" LaTeX-math-mode t]
X    ["TeX help" TeX-mode-help t]
X    ["Toggle extended debug" TeX-toggle-debug-boxes t]
X    "----"
X    ["Insert section heading" LaTeX-section t]
X    ["Insert environment" LaTeX-environment t]
X    ["Insert LaTeX item" LaTeX-insert-item t]
X    "----"
X    ["Comment out region" TeX-comment-out-region t]
X    ["Comment out paragraph" TeX-comment-out-paragraph t]
X    ["Uncomment out region" TeX-un-comment-region t]
X    "----"
X    ["Insert TeX-bold" TeX-bold t]
X    ["Insert TeX-italic" TeX-italic t]
X    ["Insert TeX-slanted" TeX-slanted t]
X    ["Insert TeX-roman" TeX-roman t]
X    ["Insert TeX-emphasize" TeX-emphasize t]
X    ["Insert TeX-typewriter" TeX-typewriter t]
X    ["Insert TeX-small-caps" TeX-small-caps t]
X    ))
X
X(defun auctex-mouse-menu (e)
X  (interactive "e")
X  (mouse-set-point e)
X  (beginning-of-line)
X  (search-forward ":" nil t)
X  (popup-menu auctex-menu))
X
X
X;;; Put the AUC-TeX menus in the menubar
X
X(defun auctex-install-menubar ()
X  (if default-menubar
X      (let ((menu (cond ((eq major-mode 'LaTeX-mode) auctex-menu)
X			(t (error "not in auctex mode")))))
X	(set-buffer-menubar (copy-sequence default-menubar))
X	(add-menu nil "AUC-TeX" (cdr menu)))))
X
X(add-hook 'LaTeX-mode-hook 'auctex-install-menubar)
X
X(define-key TeX-mode-map 'button3 'auctex-mouse-menu)
X(define-key LaTeX-mode-map  'button3 'auctex-mouse-menu)
X
X(provide 'auc-tex-lucid)
ENDIT
exit 0
--
Anthony Rossini       -       rossini@biostat.harvard.edu
Department of Biostatistics, Harvard School of Public Health
677 Huntington Ave, Boston MA 02115  617-432-1056