diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-12-15 09:19:07 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-12-15 09:19:07 -0800 |
commit | 9dc8f4914888b904a7edceae6deda5329777ae94 (patch) | |
tree | 6f18e0812d9a18049e347a9a0958dd56fd974344 | |
parent | 65821e47bfc5865a80be5d8a442dce5ff369a6ea (diff) |
Don’t assume Emacs internal timestamp format
This format is documented to change in some future Emacs version.
* lisp/ox-groff.el (org-groff--time-sec): New function.
(org-groff-compile): Use it.
-rw-r--r-- | lisp/ox-groff.el | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lisp/ox-groff.el b/lisp/ox-groff.el index 5c18085..3e376f1 100644 --- a/lisp/ox-groff.el +++ b/lisp/ox-groff.el @@ -647,16 +647,16 @@ See `org-groff-text-markup-alist' for details." ;; If FROM then get data from FROM - (if from-data + (if from-data (setq from-data (replace-regexp-in-string "\\.P\n" "" from-data)) (setq from-data "")) - - (if to-data + + (if to-data (setq to-data (replace-regexp-in-string "\\.P\n" "" to-data)) (setq from-data "")) - + (concat (cond (from-data @@ -1879,6 +1879,12 @@ Return PDF file's name." async subtreep visible-only body-only ext-plist (lambda (file) (org-groff-compile file))))) +;; Port to Emacs 26 and earlier. +(defun org-groff--time-sec (time) + (if (fboundp 'time-convert) + (time-convert time 'integer) + (cl-subseq (or time (current-time)) 0 2))) + (defun org-groff-compile (file) "Compile a Groff file. @@ -1889,7 +1895,7 @@ Return PDF file name or an error if it couldn't be produced." (let* ((base-name (file-name-sans-extension (file-name-nondirectory file))) (full-name (file-truename file)) (out-dir (file-name-directory file)) - (time (current-time)) + (time (org-groff--time-sec nil)) ;; Properly set working directory for compilation. (default-directory (if (file-name-absolute-p file) (file-name-directory full-name) @@ -1928,8 +1934,9 @@ Return PDF file name or an error if it couldn't be produced." ;; Only compare times up to whole seconds as some ;; filesystems (e.g. HFS+) do not retain any finer ;; granularity. - (time-less-p (cl-subseq (nth 5 (file-attributes pdffile)) 0 2) - (cl-subseq time 0 2))) + (time-less-p (org-groff--time-sec + (nth 5 (file-attributes pdffile))) + time)) (error (concat (format "PDF file %s wasn't produced" pdffile) (when errors (concat ": " errors)))) ;; Else remove log files, when specified, and signal end of |