Improve robustness of documentation generation

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation): Log
output and display error messages if anything goes wrong.
This commit is contained in:
Philip Kaludercic 2022-11-11 00:09:46 +01:00
parent a6cd44734d
commit 7c3d3fa44e

View file

@ -355,10 +355,8 @@ asynchronously."
FILE can be an Org file, indicated by its \".org\" extension, FILE can be an Org file, indicated by its \".org\" extension,
otherwise it's assumed to be an Info file." otherwise it's assumed to be an Info file."
(let* ((pkg-name (package-desc-name pkg-desc)) (let* ((pkg-name (package-desc-name pkg-desc))
(pkg-dir (package-desc-dir pkg-desc)) (default-directory (package-desc-dir pkg-desc))
(output (file-name-concat (output (expand-file-name (format "%s.info" pkg-name))))
(format "%s.info" pkg-name)
pkg-dir)))
(when (string-match-p "\\.org\\'" file) (when (string-match-p "\\.org\\'" file)
(require 'ox) (require 'ox)
(require 'ox-texinfo) (require 'ox-texinfo)
@ -366,10 +364,18 @@ otherwise it's assumed to be an Info file."
(insert-file-contents file) (insert-file-contents file)
(setq file (make-temp-file "ox-texinfo-")) (setq file (make-temp-file "ox-texinfo-"))
(org-export-to-file 'texinfo file))) (org-export-to-file 'texinfo file)))
(call-process "makeinfo" nil nil nil (with-current-buffer (get-buffer-create " *package-vc doc*")
"--no-split" file "-o" output) (erase-buffer)
(call-process "install-info" nil nil nil (cond
output pkg-dir))) ((/= 0 (call-process "makeinfo" nil t nil
"--no-split" file "-o" output))
(message "Failed to build manual %s, see buffer %S"
file (buffer-name)))
((/= 0 (call-process "install-info" nil t nil
output (expand-file-name "dir")))
(message "Failed to install manual %s, see buffer %S"
output (buffer-name)))
((kill-buffer))))))
(defun package-vc--unpack-1 (pkg-desc pkg-dir) (defun package-vc--unpack-1 (pkg-desc pkg-dir)
"Prepare PKG-DESC that is already checked-out in PKG-DIR. "Prepare PKG-DESC that is already checked-out in PKG-DIR.