auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] [elpa] externals/auctex 097ec6c 25/26: Avoid superfluous


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex 097ec6c 25/26: Avoid superfluous output directories
Date: Thu, 12 Aug 2021 11:18:24 -0400 (EDT)

branch: externals/auctex
commit 097ec6cb85b16479e8e4512142cec1fdb3cd5f36
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>

    Avoid superfluous output directories
    
    * tex.el (TeX--master-output-dir): Add new optional argument ENSURE so
    that it doesn't make output dir when `TeX-region-file' is called from
    `TeX-set-mode-name', which can be called from
    `TeX-source-correlate-mode' in major mode function.
    (TeX--output-dir-arg): Feed t for the above new argument ENSURE.
---
 tex.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tex.el b/tex.el
index df467de..46d6bbc 100644
--- a/tex.el
+++ b/tex.el
@@ -2545,13 +2545,14 @@ is assumed to be the same as the directory of 
`TeX-master'."
                  (string :tag "Custom" "build")))
 (make-variable-buffer-local 'TeX-output-dir)
 
-(defun TeX--master-output-dir (master-dir relative-to-master)
+(defun TeX--master-output-dir (master-dir relative-to-master &optional ensure)
   "Return the directory path where output files should be placed.
 If `TeX-output-dir' is nil, then return nil.
 
 MASTER-DIR is the directory path where the master file is
 located.  If RELATIVE-TO-MASTER is non-nil, make the returned
-path relative to the directory in MASTER-DIR."
+path relative to the directory in MASTER-DIR.  If ENSURE is
+non-nil, the output directory is created if it does not exist."
   (when TeX-output-dir
     (let* ((master-dir (expand-file-name (or master-dir "")))
            (out-dir (file-name-as-directory
@@ -2561,7 +2562,7 @@ path relative to the directory in MASTER-DIR."
                         TeX-output-dir
                         master-dir))))))
       ;; Make sure the directory exists
-      (unless (file-exists-p out-dir)
+      (unless (or (not ensure) (file-exists-p out-dir))
         (make-directory (file-name-as-directory out-dir) t))
       (if relative-to-master
           (file-relative-name out-dir master-dir)
@@ -2571,7 +2572,7 @@ path relative to the directory in MASTER-DIR."
   "Format the output directory as a command argument.
 ARGNAME is prepended to the quoted output directory.  If
 `TeX-output-dir' is nil then return an empty string."
-  (let ((out-dir (TeX--master-output-dir (TeX-master-directory) t)))
+  (let ((out-dir (TeX--master-output-dir (TeX-master-directory) t t)))
     (if out-dir
         (concat argname "\"" out-dir "\"")
       "")))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]