From 96de02c76900768ae144019ff8d69737857ebac0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 9 Jul 2024 00:24:27 -0400 Subject: [PATCH] fix(latex): auctex: build tex-site.el Auctex added a make build step to it's installation. Rather than just assume the user has the GNU variants of make, sed, and other unix utilities on their system, I simply generate tex-site.el in elisp, similar to what we do with org and its org-version.el and org-loaddefs.el files. This is a stop-gap measure until I've deployed a mirror+CD on @doomelpa. --- modules/lang/latex/packages.el | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/modules/lang/latex/packages.el b/modules/lang/latex/packages.el index 9401ee1cd..26d7b48fb 100644 --- a/modules/lang/latex/packages.el +++ b/modules/lang/latex/packages.el @@ -3,7 +3,39 @@ (package! auctex :recipe (:files ("*.el" "*.info" "dir" - "doc" "etc" "images" "latex" "style")) + "doc" "etc" "images" "latex" "style") + ;; HACK: Auctex has a post-install step that generates tex-site.el + ;; and *.texi documentation files, which largely assumes the user + ;; is on a Linux system with various shell tools like sed, gnu + ;; make, tex, etc. -- an assumption I can't safely make about + ;; Doom's users, so reinvent its 'make tex-site.el' task in elisp: + :pre-build + (with-temp-file "tex-site.el" + (insert-file-contents "tex-site.el.in") + (while (re-search-forward "@\\(\\(?:AUCTEX\\|lisp\\)[^@]+\\)@" nil t) + (pcase (match-string 1) + ("AUCTEXVERSION" + (replace-match (with-temp-buffer + (insert-file-contents "auctex.el" nil 0 1024) + (save-match-data + (if (re-search-forward "^;; Version: \\([^\n-]+\\)" nil t) + (match-string-no-properties 1) + "Unknown"))) + t t)) + ("AUCTEXDATE" + (when-let* ((time (cdr (doom-call-process "git" "log" "-n1" "--pretty=tformat:%ct"))) + (time (string-to-number time))) + (replace-match (format-time-string "%Y-%m-%d %T" time) t t))) + ("lispautodir" + (replace-match + (prin1-to-string + `(if (file-writable-p "/usr/local/var/auctex") + "/usr/local/var/auctex" + ,(file-name-concat doom-data-dir "auctex"))) + t t)) + ((or "lisppackagedatadir" "lisppackagelispdir") + (replace-match "(directory-file-name (file-name-directory load-file-name))" t t)) + (it (error "Unknown substitution variable in tex-site.el.in: %s" it)))))) :pin "764a53c8e93150f0edd169593a4d453810792abe") (package! adaptive-wrap :pin "dea4e32c18d285a6ca9f72b1eadd61e27a555ed3") (package! latex-preview-pane :pin "5297668a89996b50b2b62f99cba01cc544dbed2e")