auctex-devel
[Top][All Lists]
Advanced

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

Re: [BUG]


From: Al Haji-Ali
Subject: Re: [BUG]
Date: Wed, 03 Feb 2021 16:12:16 +0000
User-agent: mu4e 1.5.8; emacs 27.1

On 03/02/2021, Uwe Brauer wrote:
>> I have my setup like this
>
>> (setq TeX-output-dir  "build"
>>       TeX-region      "build/_region_")
>
> Ah of course, I still sticked to the local buffer setting for testing.
> This is much better, because I realised that I almost entirely will use
> a build directory.
>
I have this in a hook, so it is still set locally.
If you want to include this in your emacs init to use a build directory by 
default for all buffers be sure to use setq-default instead of setq.

> BTW your function copy-tex-output is also very useful for me, maybe it
> should be included as well?

Yes, it probably should be included as well, perhaps as a command that can 
invoked from TeX-command-master. Although it is easy enough for users to 
include it in their config. I didn't want to make too many changes to AUCTeX 
before the one I have are finalized/approved.

For the benefit of others, below are two functions to copy the output file to 
other directories (defaults to directory of the master file) and to attach the 
output file to an email

(defun TeX-copy-output ()
   (interactive)
   (let* ((default (expand-file-name (TeX-active-master nil)))
          (default-dir (file-name-directory default))
          (default-file (concat (file-name-nondirectory default) "." 
(TeX-output-extension)))
          (outputfile (expand-file-name (TeX-active-master 
(TeX-output-extension))))
          (filename (read-file-name "Save as:" default-dir
                     default-file nil default-file)))
     (copy-file outputfile filename t)))


(defun TeX-attach-output ()
   (interactive)
   (require 'gnus-dired)
   (gnus-dired-attach (list (expand-file-name (TeX-active-master 
(TeX-output-extension))))))


One could also add the following hook so that only the (pdf or dvi) output file 
is automatically copied to the master directory after compilation:

(add-hook 'TeX-after-compilation-finished-functions
          (lambda (file)
            (let ((output (expand-file-name file))
                  (copy (expand-file-name (concat
                                           (with-current-buffer 
TeX-command-buffer
                                             (TeX-active-master nil))
                                           "." (TeX-output-extension)))))
              (when (and (not (string= output copy)) (file-exists-p output))
                (copy-file output copy t)))))


I don't use this last hook since it defeats the purpose of the output-directory 
patch for me, but some people might find it useful.

Regards,
-- Al



reply via email to

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