help-gnu-emacs
[Top][All Lists]
Advanced

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

Active processes exist; kill them and exit anyway?


From: Hongyi Zhao
Subject: Active processes exist; kill them and exit anyway?
Date: Tue, 9 May 2023 17:22:52 +0800

Hi here,

On Ubuntu 22.10, I'm currently using the following settings to trigger
Tex file compilation automatically with Emacs + Auctex + smart-compile
+ latexmk when its content is changed and saved.

The latexmk configuration:

werner@X10DAi:~$ grep -v '^[ ]*#' ~/.latexmkrc | awk 'NF >0'
$show_time=1;
$pdf_mode = 1;
$pdflatex = "pdflatex -shell-escape -file-line-error -halt-on-error
-interaction=nonstopmode -synctex=1 %O %S";
$bibtex = "bibtex %O %S";
$bibtex_use = 2;
$makeindex = "makeindex %O -o %D %S";
$silence_logfile_warnings = 1;
   add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' );
   add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
   $clean_ext .= " acr acn alg glo gls glg";
   sub makeglossaries {
      my ($base_name, $path) = fileparse( $_[0] );
      pushd $path;
      my $return = system "makeglossaries", $base_name;
      popd;
      return $return;
   }
add_cus_dep( 'svg', 'pdf', 0, 'makesvg2pdf' );
sub makesvg2pdf {
    system( "inkscape \"$_[0].svg\" --export-pdf=\"$_[0].pdf\"" );
}
$pdf_previewer = 'evince %O %S';


The Emacs init.el configuration:

(defvar hz/AUCTeX-process nil)
(use-package smart-compile
  :init
  (declare-function smart-compile-string "smart-compile")
  (defun run-latexmk ()
    (when (string-match ".tex$" (buffer-file-name))
      (unless (and (processp hz/AUCTeX-process)
           (eq (process-status hz/AUCTeX-process) 'run))
    (let ((buf (get-buffer-create "*Background TeX proccess*")))
      (with-current-buffer buf (erase-buffer)) ;; flush previous log
      (setq hz/AUCTeX-process
        (start-process-shell-command
         "Background TeX" buf
         ;; use an external application as the previewer
         (smart-compile-string "latexmk -pvc %f")

         ;; use pdf-tools
         ;; (smart-compile-string "latexmk %f")
         ))))))
  (define-minor-mode AutoTeX-mode
    "Mode for compiling latex sources and creating PDFs after saving."
    :global nil
    :lighter " Auto"
    (if AutoTeX-mode
    (add-hook 'after-save-hook 'run-latexmk t t)
      (remove-hook 'after-save-hook 'run-latexmk t)))

  :hook (LaTeX-mode . (lambda () (AutoTeX-mode 1))))


Though it works smoothly, I have observed that when I attempt to
exit Emacs after closing the PDF previewer window that was launched by
the command `latexmk -pvc` via the above configuration, a message is
always displayed within Emacs, as shown in the attached screenshot. I
was wondering if you might be able to provide some insight into why
this might be happening, and if there are any possible solutions to
fix this issue.

N.B.: Some related discussions:

[1] https://lists.gnu.org/archive/html/auctex/2021-07/msg00013.html
[2] https://tam5917.hatenablog.com/entry/2021/04/10/134230
[3] https://lists.gnu.org/archive/html/auctex/2021-10/msg00013.html
[4] https://lists.gnu.org/archive/html/auctex/2023-05/msg00068.html

Regards,
Zhao
-- 
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province

Attachment: image.png
Description: PNG image


reply via email to

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