forked from mirrors/org-mode
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.
This commit is contained in:
parent
926dbafe43
commit
81eb8c5f9e
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -71,6 +71,16 @@
|
|||
(defvar org-table-tab-recognizes-table.el)
|
||||
(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
|
||||
|
||||
|
|
Loading…
Reference in a new issue