Loads more updates -- large assortment of stuffs
[syinit] / 06-tex-site-sy.el
index 598845f..564ad59 100644 (file)
@@ -5,10 +5,10 @@
 ;;     Author: Steve Youngs <steve@sxemacs.org>
 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
 ;;    Created: <2007-12-02>
-;; Time-stamp: <Wednesday Feb 12, 2020 12:48:57 steve>
+;; Time-stamp: <Thursday Mar 19, 2020 10:58:18 steve>
 ;;   Download: <http://bastard.steveyoungs.com/~steve/SXEmacs/inits/>
 ;;   HTMLised: <http://bastard.steveyoungs.com/~steve/SXEmacs/htmlinits/06-tex-site-sy.html>
-;;   Git Repo: git clone http://git.sxemacs.org/syinit
+;;   Git Repo: git clone https://git.sxemacs.org/syinit
 ;;   Keywords: init, compile
 
 ;; This file is part of SYinit
 Full documentation will be available after autoloading the function."
   "Documentation for autoload functions.")
 
-(defcustom TeX-image-directory
-  (if (featurep 'xemacs)
+(setq TeX-image-directory
       (file-name-as-directory
-       (expand-file-name "images" (locate-data-directory "auctex")))
-    (file-name-as-directory (concat TeX-lisp-directory "images")))
-  "*Directory containing hand generated TeX information.
-Must end with a directory separator.
-
-These correspond to TeX macros shared by all users of a site."
-  :group 'TeX-file
-  :type 'directory)
-
-(defcustom TeX-auto-global
-  (file-name-as-directory
-   (expand-file-name "auto"
-                    (locate-data-directory "auctex")))
-  "*Directory containing automatically generated information.
-Must end with a directory separator.
-For storing automatic extracted information about the TeX macros
-shared by all users of a site."
-  :group 'TeX-file
-  :type 'directory)
-
+       (expand-file-name "images" (locate-data-directory "auctex"))))
+
+;; System-wide writable directories are a bad idea at the best of
+;; times.  Pretty much the only way of doing it even remotely safely
+;; is to use 1777 perms on the directory.  Until I update AUCTeX to do
+;; just that this var will default to nil unless it is writable to me.
+(setq TeX-auto-global
+      (let ((dir (file-name-as-directory
+                 (expand-file-name "auto"
+                                   (locate-data-directory "auctex")))))
+       (or (and (file-writable-p dir) dir)
+           ;; If it doesn't exist but parent is writable, allow it.
+           (and (file-writable-p (file-dirname dir)) dir))))
+
+;:*=======================
+;:* LaTeX or latex ???
+;; Remove the built-in ones that use latex-mode
+(remove-alist 'auto-mode-alist "\\.\\(?:sty\\|cls\\|bbl\\)\\'")
+(remove-alist 'auto-mode-alist "\\.[tT]e[xX]\\'")
+(remove-alist 'auto-mode-alist "\\.ltx\\'")
+;; Add them back for LaTeX-mode
+(add-to-list 'auto-mode-alist '("\\.\\(?:sty\\|cls\\|bbl\\)\\'" . LaTeX-mode))
+(add-to-list 'auto-mode-alist '("\\.[tT]e[xX]\\'" . LaTeX-mode))
+(add-to-list 'auto-mode-alist '("\\.ltx\\'" . LaTeX-mode))
+(add-to-list 'auto-mode-alist '("\\.drv\\'" . LaTeX-mode))
+;; doctex
 (add-to-list 'auto-mode-alist '("\\.dtx\\'" . doctex-mode))
-(add-to-list 'auto-mode-alist '("\\.drv\\'" . latex-mode))
 
 ;; This hook will store bibitems when you save a BibTeX buffer.
 (add-hook 'bibtex-mode-hook 'BibTeX-auto-store)
@@ -107,6 +110,8 @@ shared by all users of a site."
 (autoload 'japanese-plain-tex-mode "tex-jp" no-doc t)
 (autoload 'japanese-latex-mode "tex-jp" no-doc t)
 (autoload 'latex-mode "latex" no-doc t)
+(autoload 'LaTeX-mode "latex" no-doc t)
+(autoload 'TeX-latex-mode "latex" no-doc t)
 
 ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 (message "Sane tex-site loaded successfully")