[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-attach-sync uses directory-empty-p (new in Emacs 28)

From: Marco Wahl
Subject: Re: org-attach-sync uses directory-empty-p (new in Emacs 28)
Date: Tue, 10 Aug 2021 22:52:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Arthur Miller <arthur.miller@live.com> writes:

> Kyle Meyer <kyle@kyleam.com> writes:
>> In 61e083732 (org-attach: Possibly delete empty attach directory,
>> 2021-07-09), you added a call to directory-empty-p.  This function was
>> introduced in Emacs's 0806075520 (Add directory-empty-p and new argument
>> COUNT for directory-files-*, 2020-11-02) and hasn't yet made it into a
>> release.
>> Could you update org-attach-sync to avoid using directory-empty-p (e.g.,
>> by inlining it or by adding a compatibility alias)?

> Can this help:
> #+begin_src emacs-lisp
> (when (version< emacs-version "28")
>   (defun directory-empty-p (file-name)
>     "Check if a directory contains any other files then dot-files"
>     (when (file-directory-p file-name)
>       (null (directory-files file-name nil
>                              directory-files-no-dot-files-regexp t)))))
> #+end_src

Thanks Kyle and Arthur!

Starting from Arthur's suggestion and Kyle's hint to the compatibility
alias I put org-directory-empty-p into org-compat.el.  So there is
org-directory-empty-p now which provides the functionality of
directory-empty-p from Emacs 28 for smaller version Emacsen.

org-directory-empty-p is defined in org-compat.el.  From there
org-directory-empty-p can (and hopefully will) be easily dropped when
the minimum required Emacs version for Org switches to 28.

Thanks again and best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]