Tassilo Horn <[email protected]> writes:

> David Kastrup <[email protected]> writes:
>
>>>   (add-hook 'TeX-mode-hook 'TeX-PDF-mode)
>>
>> That's probably about the worst thing you can do.  It will switch off
>> PDF mode for everything which PDF mode would otherwise be chosen for and
>> vice versa.
>
> Ups, I'm using this for years, and never had any problems.  Or at least
> I didn't notice them. :-)
>
> And isn't it true that (add-hook 'foo-hook 'bar-mode) will always turn
> on the minor mode `bar-mode', i.e., not toggle?  Ah, no, that's emacs
> 24.1+ only...
>
> ,----
> | * Incompatible Lisp Changes in Emacs 24.1
> | 
> | ** Passing a nil argument to a minor mode function call now ENABLES
> | the minor mode unconditionally.  This is so that you can write e.g.
> | 
> |  (add-hook 'text-mode-hook 'foo-mode)
> | 
> | to enable foo-mode in Text mode buffers, removing the need for
> | `turn-on-foo-mode' style functions.  This affects all mode commands
> | defined by `define-minor-mode'.  If called interactively, the mode
> | command still toggles the minor mode.
> `----
>
>> So it will do what you want only when AUCTeX is without a clue, and do
>> the wrong thing whenever AUCTeX would know better.
>
> In what cases would AUCTeX automatically determine that it should
> compile to PDF instead of DVI and vice versa?

Looking in latex.el shows something like

  (TeX-add-style-hook "pdftex" 'TeX-PDF-mode-on)
  (TeX-add-style-hook "pdftricks" 'TeX-PDF-mode-on)
  (TeX-add-style-hook "pst-pdf" 'TeX-PDF-mode-on)
  (TeX-add-style-hook "dvips" 'TeX-PDF-mode-off)
;; This is now done in style/pstricks.el because it prevents other
;; pstricks style files from being loaded.
;;   (TeX-add-style-hook "pstricks" 'TeX-PDF-mode-off)
  (TeX-add-style-hook "psfrag" 'TeX-PDF-mode-off)
  (TeX-add-style-hook "dvipdf" 'TeX-PDF-mode-off)
  (TeX-add-style-hook "dvipdfm" 'TeX-PDF-mode-off)
;;  (TeX-add-style-hook "DVIoutput" 'TeX-PDF-mode-off)
;;
;;  Well, DVIoutput indicates that we want to run PDFTeX and expect to
;;  get DVI output.  Ugh.
  (TeX-add-style-hook "ifpdf" (lambda ()
                                (TeX-PDF-mode-on)
                                (TeX-PDF-mode-off)))
;; ifpdf indicates that we cater for either.  So calling both
;; functions will make sure that the default will get used unless the
;; user overrode it.

-- 
David Kastrup

_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to