瀏覽代碼

org-compat: Silence byte compiler for Emacsversion < 28

Check availablility of function directory-empty-p directly instead of
relying on Emacs version.

Thanks Maxim and Kyle for the help.  See
https://orgmode.org/list/87pmun8t2o.fsf@kyleam.com/ .
Marco Wahl 4 年之前
父節點
當前提交
3664447eb2
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      lisp/org-compat.el

+ 6 - 6
lisp/org-compat.el

@@ -74,12 +74,12 @@
 
 ;;; Emacs < 28.1 compatibility
 
-(if (version< emacs-version "28")
-    (defun org-directory-empty-p (dir)
-      "Return t if DIR names an existing directory containing no other files."
-      (and (file-directory-p dir)
-           (null (directory-files dir nil directory-files-no-dot-files-regexp t))))
-  (defalias 'org-directory-empty-p #'directory-empty-p))
+(if (fboundp 'directory-empty-p)
+    (defalias 'org-directory-empty-p #'directory-empty-p)
+  (defun org-directory-empty-p (dir)
+    "Return t if DIR names an existing directory containing no other files."
+    (and (file-directory-p dir)
+         (null (directory-files dir nil directory-files-no-dot-files-regexp t)))))
 
 
 ;;; Emacs < 27.1 compatibility