unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Active processes exist; kill them and exit anyway?
@ 2023-05-09  9:22 Hongyi Zhao
  0 siblings, 0 replies; only message in thread
From: Hongyi Zhao @ 2023-05-09  9:22 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 3101 bytes --]

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 #2: image.png --]
[-- Type: image/png, Size: 151655 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-09  9:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-09  9:22 Active processes exist; kill them and exit anyway? Hongyi Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).