[OS X TeX] Emacs 22.92, %! and TeXShop
stephenmoye at cox.net
Fri Jan 26 03:49:52 CET 2007
On Jan 25, 2007, at 9:10 PM, Jens Noeckel wrote:
> On Jan 25, 2007, at 5:41 PM, Stephen Moye wrote:
>> On Jan 25, 2007, at 8:34 PM, Stephen Moye wrote:
>>> I just started using emacs 22.92 -- I have been using emacs
>>> 22.50. Unlike v22.50, when I open a TeXShop TeX file with emacs
>>> 22.92, it is opened as a PostScript file. I imagined that it had
>>> something to do with the first line of the file:
>>> %!TEX TS-program = latex
>>> Sure enough, I went digging using
>>> C-h v auto-mode-alist
>>> and found a line in files.el:
>>> ("%![^V]" . ps-mode)
>>> in addition to what I expected:
>>> ("\\.[tT]e[xX]\\'" . tex-mode)
>>> So emacs is looking inside the file to make a better guess about
>>> what kind of file it is. I tried changing
>>> ("%![^V]" . ps-mode)
>>> ("%![^VT]" . ps-mode)
>>> but that did not work.
>>> I really like emacs 22.nn, but this is a bit of a bother. Can I
>>> put something in my .emacs file to counter this unwanted
>>> cleverness? I know that I can put
>>> as the first line of the file and both emacs and TeXShop will be
>>> happy, but that seems an unnecessary complication.
>>> Any suggestions? Or, alternatively, where else should I more
>>> appropriately post this query?
>>> Thank you for any insights.
>> Sorry, but I should have mentioned that I am using emacs under X11.
> not knowing what exactly is in your .emacs already, I would suggest
> adding the line
> (setq auto-mode-alist (cons '("\\.tex$" . tex-mode) auto-
> as close to the end of .emacs as possible (so that it doesn't get
> overridden by other associations - the order of these things matters).
I placed the line you suggested at the very end of my .emacs file
(which has very little in it), but a TeX file with %! at the top
still opened as a PostScript file.
I am puzzled. Shouldn't the extension take precedence over anything
else? Surely a .tex file is almost certainly not going to be a
Anyway, thank you for the suggestion though.
PS I did make the discovery that if the first line of the TeX file is
empty and the *second* line begins with %! then the emacs mechanism
is fooled and the file opens in TeX mode. Hmmmm...
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the macostex-archives