[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 81eb8c5 1/2: attach: Fix for Emacs<28
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 81eb8c5 1/2: attach: Fix for Emacs<28 |
Date: |
Tue, 10 Aug 2021 16:57:13 -0400 (EDT) |
branch: externals/org
commit 81eb8c5f9e4e8fe7e97c7358691edad7e694372b
Author: Marco Wahl <marcowahlsoft@gmail.com>
Commit: Marco Wahl <marcowahlsoft@gmail.com>
attach: Fix for Emacs<28
* lisp/org-compat.el: Introduce org-directory-empty-p which is
directory-empty-p from Emacs 28.
* lisp/org-attach.el (org-attach-sync): Use org-directory-empty-p instead
of directory-empty-p.
* etc/ORG-NEWS: Note about org-directory-empty-p.
Thanks Kyle identifying the issue. Thanks Arthur for suggesting a
fix.
---
etc/ORG-NEWS | 2 ++
lisp/org-attach.el | 2 +-
lisp/org-compat.el | 10 ++++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 78a57ba..83a67da 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -421,6 +421,8 @@ Tag completion now uses =completing-read-multiple= with a
simple
completion table, which should allow better interoperability with
custom completion functions.
+*** Providing =directory-empty-p= from Emacs 28 as =org-directory-empty-p=
+
* Version 9.4
** Incompatible changes
*** Possibly broken internal file links: please check and fix
diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index e8e8ade..f184531 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -622,7 +622,7 @@ empty attachment directories."
(let ((files (org-attach-file-list attach-dir)))
(org-attach-tag (not files)))
(when org-attach-sync-delete-empty-dir
- (when (and (directory-empty-p attach-dir)
+ (when (and (org-directory-empty-p attach-dir)
(if (eq 'query org-attach-sync-delete-empty-dir)
(yes-or-no-p "Attachment directory is empty. Delete?")
t))
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index ff992f3..866e2c3 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -72,6 +72,16 @@
(defvar org-table1-hline-regexp)
+;;; 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 1))))
+ (defalias 'org-directory-empty-p #'directory-empty-p))
+
+
;;; Emacs < 27.1 compatibility
(unless (fboundp 'proper-list-p)