branch: externals/org commit 499bd92e26e125ca770ca144e5179749b9c8d827 Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
org-compile-file: Do not treat unchanged existing target as compilation failure * lisp/org-macs.el (org-compile-file): Fix reporting failure when existing target file hasn't changed. That might be a perfectly valid outcome of compilation when the compilation source already matches the target (e.g. when using latexmk). Instead, look into (1) target file not being present; (2) shell commands returning non-0 exit code. When compile command is a Elisp function, do not treat return value special to avoid breaking backwards compatibility (see commend in the code). * lisp/org.el (org-preview-latex-process-alist): * lisp/ox-texinfo.el (org-texinfo-info-process): Update the docstrings clarifying the possibility to use Elisp function rather than a list of strings. Reported-by: Jake <jforst.mail...@gmail.com> Link: https://orgmode.org/list/CAJqVjv80CCio84brc6hgosdXJFqaYsvqmZmkxn611NahEnG=n...@mail.gmail.com --- lisp/org-macs.el | 13 ++++++++++--- lisp/org.el | 16 +++++++++++----- lisp/ox-texinfo.el | 11 ++++++++--- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 292dfff03a..9b205b69a4 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -1713,18 +1713,25 @@ it for output." (file-relative-name source pwd)) source)) (log-buf (and log-buf (get-buffer-create log-buf))) - (time (file-attribute-modification-time (file-attributes output)))) + exit-status (did-error nil)) (save-window-excursion (dolist (command commands) (cond ((functionp command) + ;; We could treat return value of the function + ;; as return code in shell command, but that would be + ;; a breaking changed compared to historical behavior. + ;; Functions might still take care to remove the target file + ;; (if it already exists) to mark failure. (funcall command (shell-quote-argument relname))) ((stringp command) (let ((shell-command-dont-erase-buffer t)) - (shell-command command log-buf)))))) + (setq exit-status (shell-command command log-buf)) + (when (and (numberp exit-status) (> exit-status 0)) + (setq did-error t))))))) ;; Check for process failure. Output file is expected to be ;; located in the same directory as SOURCE. - (unless (org-file-newer-than-p output time) + (when (or did-error (not (file-exists-p output))) (ignore (defvar org-batch-test)) ;; Display logs when running tests. (when (bound-and-true-p org-batch-test) diff --git a/lisp/org.el b/lisp/org.el index 80a6fff933..ad66edda5b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3455,12 +3455,18 @@ PROPERTIES accepts the following attributes: controlled by `org-format-latex-header', `org-latex-default-packages-alist' and `org-latex-packages-alist', which see. - :latex-compiler list of LaTeX commands, as strings. Each of them is given - to the shell. Place-holders \"%t\", \"%b\" and \"%o\" are + :latex-compiler list of LaTeX commands, as strings or a function. + Each of them is given to the shell. + Place-holders \"%t\", \"%b\" and \"%o\" are replaced with values defined below. - :image-converter list of image converter commands strings. Each of them is - given to the shell and supports any of the following - place-holders defined below. + When a function, that function should accept the + file name as its single argument. + :image-converter list of image converter commands strings or a + function. Each of them is given to the shell + and supports any of the following place-holders + defined below. + When a function, that function should accept the + file name as its single argument. If set, :transparent-image-converter is used instead of :image-converter to convert an image when the background color is nil or \"Transparent\". diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index a99656c3c3..e3ecd23e6f 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -390,11 +390,16 @@ shell as a command. %f in the command will be replaced by the relative file name, %F by the absolute file name, %b by the file base name (i.e. without directory and extension parts), %o by the base directory of the file and %O by the absolute file name of -the output file." +the output file. + +Alternatively, this may be a Lisp function that does the processing, +This function should accept the file name as its single argument." :version "26.1" :package-version '(Org . "9.1") - :type '(repeat :tag "Shell command sequence" - (string :tag "Shell command"))) + :type '(choice + (repeat :tag "Shell command sequence" + (string :tag "Shell command")) + (function))) (defcustom org-texinfo-logfiles-extensions '("aux" "toc" "cp" "fn" "ky" "pg" "tp" "vr")