From 5ea1322c99073ce15b3917cb2f7c2ed1b7d0095f Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 19 Feb 2013 18:01:03 +0100 Subject: [PATCH] org-compat.el (org-file-equal-p): New compatibility function * org-compat.el (org-file-equal-p): New compatibility function. * ox.el (org-export-output-file-name): Use the new function. Thanks to Mark Edgington for reporting this. --- lisp/org-compat.el | 10 ++++++++++ lisp/ox.el | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 998695837..b4d774824 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -489,6 +489,16 @@ With two arguments, return floor and remainder of their quotient." (defun org-release () "N/A") (defun org-git-version () "N/A !!check installation!!")))))) +(defun org-file-equal-p (f1 f2) + "Return t if files F1 and F2 are the same. +Implements `file-equal-p' for older emacsen and XEmacs." + (if (fboundp 'file-equal-p) + (file-equal-p f1 f2) + (let (f1-attr f2-attr) + (and (setq f1-attr (file-attributes (file-truename f1))) + (setq f2-attr (file-attributes (file-truename f2))) + (equal f1-attr f2-attr))))) + (provide 'org-compat) ;;; org-compat.el ends here diff --git a/lisp/ox.el b/lisp/ox.el index 70c59e79d..efce29d5c 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -3008,7 +3008,7 @@ Return file name as a string." (t (concat (file-name-as-directory ".") base-name extension))))) ;; If writing to OUTPUT-FILE would overwrite original file, append ;; EXTENSION another time to final name. - (if (and visited-file (file-equal-p visited-file output-file)) + (if (and visited-file (org-file-equal-p visited-file output-file)) (concat output-file extension) output-file)))