I suggest the patch below which renames `tex-site.el.in` to
`tex-site.el`.  We lose the `AUCTEX-date` info, but IMO the
simplification is worth this minor downside (at least for GNU-devel
ELPA packages, the date is encoded in the `AUCTEX-version`).

[ We could keep `AUCTEX-version` in `tex-site.el`, but IIRC
  `package-get-version` works more reliably if it's in the same file
  where we have the `Version:` header.  ]


        Stefan
diff --git a/.gitignore b/.gitignore
index d33b61ad59..af36384a3e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,8 +17,6 @@ auto-loads.el
 autom4te.*
 config.*
 configure
-tex-site.el
-tex-site.el.out
 
 # Files generated while building the auto-generated files included in elpa.
 doc/preview-dtxdoc.texi
diff --git a/GNUmakefile b/GNUmakefile
index 776e0cee4e..73fa3fdde1 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -3,7 +3,6 @@
 # Files we need to auto-generate for elpa:
 #   README
 #   ChangeLog
-#   tex-site.el
 #   doc: preview-dtxdoc.texi
 #   doc: version.texi
 #   doc: tex-ref.pdf
@@ -33,7 +32,6 @@ TEXMFGEN:=$(shell sed -n 's/^%<installer>.*file[{]\([^}.]*\.[sdc][tef][yfg]\)[}]
 LATEX_FILES:=$(patsubst %, latex/%, $(shell echo $$(echo "$(TEXMFGEN)")))
 
 MAIN_GENERATED_FILES=README 		\
-		tex-site.el		\
 		doc/version.texi	\
 		doc/preview-dtxdoc.texi	\
 		doc/tex-ref.pdf         \
@@ -46,7 +44,7 @@ ALL_GENERATED_FILES=$(MAIN_GENERATED_FILES)	\
 # Generate & compile everything including the manuals below doc/.
 all: $(ALL_GENERATED_FILES) compile auctex-autoloads.el
 
-compile: $(patsubst %.el,%.elc,$(wildcard *.el style/*.el)) tex-site.elc
+compile: $(patsubst %.el,%.elc,$(wildcard *.el style/*.el))
 
 # If we were depending on emacs 29.1, we could simply use
 # loaddefs-generate...
@@ -87,11 +85,6 @@ auctex-autoloads.el:
 # compiling is done locally.
 elpa: $(MAIN_GENERATED_FILES) ChangeLog
 
-# We want the tex-site.el target to be always run so that the version
-# (especially the release version grabbed from the top of the git log)
-# is correct.
-.PHONY: tex-site.el
-
 clean:
 	rm -f $(ALL_GENERATED_FILES) \
 		$(wildcard *.elc style/*.elc) \
@@ -126,11 +119,6 @@ LASTVERSION:=$(shell grep "^;; Version:" auctex.el \
                      | sed -nre 's/;; Version: ([0-9]+.[0-9]+.[0-9]+)/\1/p;q')
 AUCTEXVERSION:=$(if $(THISVERSION),$(THISVERSION),$(LASTVERSION).$(AUCTEXDATE))
 
-tex-site.el: tex-site.el.in
-	sed -e 's|@AUCTEXVERSION@|$(AUCTEXVERSION)|'\
-	    -e 's|@AUCTEXDATE@|$(AUCTEXDATE)|'\
-	    $< >$@
-
 doc/version.texi:
 	echo @set VERSION $(AUCTEXVERSION) >$@
 	echo @set UPDATED $(AUCTEXDATE) >>$@
diff --git a/auctex.el b/auctex.el
index 9ad7ac1785..8b1cc517c8 100644
--- a/auctex.el
+++ b/auctex.el
@@ -41,6 +41,10 @@
 (require 'tex-site
          (expand-file-name "tex-site.el"
                            (file-name-directory load-file-name)))
+
+(defconst AUCTeX-version (package-get-version)
+  "AUCTeX version.")
+
 (provide 'auctex)
 
 ;; Local Variables:
diff --git a/preview.el b/preview.el
index e4d674ade5..c056e3f7bf 100644
--- a/preview.el
+++ b/preview.el
@@ -38,7 +38,7 @@
 
 ;;; Code:
 
-(require 'tex-site)
+(require 'auctex)
 (require 'tex)
 (require 'latex)
 
@@ -1298,7 +1298,7 @@ are functions to call on preview's clicks."
   (let ((buff (get-buffer-create
                "*Preview-Ghostscript-Error*")))
     (with-current-buffer buff
-      (kill-all-local-variables)
+      (fundamental-mode)
       (setq-local view-exit-action #'kill-buffer)
       (setq buffer-undo-list t)
       (erase-buffer)
@@ -4337,9 +4337,6 @@ internal parameters, STR may be a log to insert into the current log."
   "Preview version.
 If not a regular release, the date of the last change.")
 
-(defconst preview-release-date AUCTeX-date
-  "Preview release date using the ISO 8601 format, yyyy-mm-dd.")
-
 (defun preview-dump-state (buffer)
   (condition-case nil
       (progn
diff --git a/tex-site.el.in b/tex-site.el
similarity index 97%
rename from tex-site.el.in
rename to tex-site.el
index 462a7575c3..c23ecbd83f 100644
--- a/tex-site.el.in
+++ b/tex-site.el
@@ -193,13 +193,6 @@ Otherwise, restore AUCTeX definition saved in the symbol property
   (if (featurep 'tex-site)
       (TeX--alias-overlapped-modes t)))
 
-(defconst AUCTeX-version "@AUCTEXVERSION@"
-  "AUCTeX version.
-If not a regular release, the date of the last change.")
-
-(defconst AUCTeX-date "@AUCTEXDATE@"
-  "AUCTeX release date using the ISO 8601 format, yyyy-mm-dd.")
-
 ;; Store bibitems when saving a BibTeX buffer
 (add-hook 'bibtex-mode-hook #'BibTeX-auto-store)
 
diff --git a/tex.el b/tex.el
index ea688f17ba..9f54f2505b 100644
--- a/tex.el
+++ b/tex.el
@@ -32,7 +32,7 @@
   (error "AUCTeX requires Emacs 27.1 or later"))
 
 (require 'custom)
-(require 'tex-site)
+(require 'auctex)
 (require 'cl-lib)
 (require 'subr-x)
 (require 'texmathp)
@@ -6519,8 +6519,7 @@ information about your AUCTeX version and AUCTeX configuration."
     (reporter-submit-bug-report
      "bug-auc...@gnu.org"
      AUCTeX-version
-     (list 'AUCTeX-date
-           'window-system
+     (list 'window-system
            'LaTeX-version
            'TeX-style-path
            'TeX-auto-save

Reply via email to