From 54d980100ebe532d7b07caa1dad608cde3c4290d Mon Sep 17 00:00:00 2001
From: Paul Nelson <ultrono@gmail.com>
Date: Sun, 21 Apr 2024 22:55:00 +0200
Subject: [PATCH] Add function TeX-master-output-file

* tex.el (TeX-master-output-file): New function.
---
 tex.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tex.el b/tex.el
index 2ab35875..370dd4d7 100644
--- a/tex.el
+++ b/tex.el
@@ -2604,6 +2604,16 @@ ARGNAME is prepended to the quoted output directory.  If
         (concat argname "\"" out-dir "\"")
       "")))
 
+(defun TeX-master-output-file (extension)
+  "Return the output file with given EXTENSION.
+If `TeX-output-dir' is nil, then defer to `TeX-master-file'.  Otherwise,
+return the file of the same name, but in the build directory specified by
+`TeX-output-dir'."
+  (let ((master (TeX-master-file extension)))
+    (if-let ((output-dir (TeX--master-output-dir (TeX-master-directory) t)))
+        (concat output-dir (file-name-nondirectory master))
+      master)))
+
 (defcustom TeX-style-local "style"
   "Directory containing hand generated TeX information.
 
-- 
2.39.3 (Apple Git-145)

