Remove temporary .texi files if used to build documentation

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Remember if a temporary file was generated and delete it afterwards.
This commit is contained in:
Philip Kaludercic 2022-11-15 13:27:59 +01:00
parent 11cb810356
commit 32f51f17c4

View file

@ -355,14 +355,16 @@ FILE can be an Org file, indicated by its \".org\" extension,
otherwise it's assumed to be an Info file."
(let* ((pkg-name (package-desc-name pkg-desc))
(default-directory (package-desc-dir pkg-desc))
(output (expand-file-name (format "%s.info" pkg-name))))
(output (expand-file-name (format "%s.info" pkg-name)))
clean-up)
(when (string-match-p "\\.org\\'" file)
(require 'ox)
(require 'ox-texinfo)
(with-temp-buffer
(insert-file-contents file)
(setq file (make-temp-file "ox-texinfo-"))
(org-export-to-file 'texinfo file)))
(org-export-to-file 'texinfo file)
(setq clean-up t)))
(with-current-buffer (get-buffer-create " *package-vc doc*")
(erase-buffer)
(cond
@ -374,7 +376,9 @@ otherwise it's assumed to be an Info file."
output (expand-file-name "dir")))
(message "Failed to install manual %s, see buffer %S"
output (buffer-name)))
((kill-buffer))))))
((kill-buffer))))
(when clean-up
(delete-file file))))
(defun package-vc--unpack-1 (pkg-desc pkg-dir)
"Prepare PKG-DESC that is already checked-out in PKG-DIR.