Skip to content

Commit

Permalink
fix: Try not to rely on 28.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Sep 3, 2023
1 parent ade0482 commit 3d8b65b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
15 changes: 11 additions & 4 deletions lisp/_prepare.el
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,23 @@ Argument BODY are forms for execution."
(mapc (lambda (elm) (setq result (max result (length (eask-2str elm))))) sequence)
result))

(defun eask-f-filename (path)
"Return the name of PATH."
(file-name-nondirectory (directory-file-name path)))

(defun eask-s-replace (old new s)
"Replace OLD with NEW in S each time it occurs."
(if (fboundp #'string-replace)
(string-replace old new s)
(replace-regexp-in-string (regexp-quote old) new s t t)))

(defun eask-f-filename (path)
"Return the name of PATH."
(file-name-nondirectory (directory-file-name path)))

(defun eask-directory-empty-p (dir)
"Return t if DIR names an existing directory containing no other files.
The function `directory-empty-p' only exists 28.1 or above; copied it."
(and (file-directory-p dir)
(null (directory-files dir nil directory-files-no-dot-files-regexp t 1))))

;;
;;; Progress

Expand Down
2 changes: 1 addition & 1 deletion lisp/clean/dist.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
(when (eask-delete-file readme) (cl-incf deleted))
(when (eask-delete-file entry) (cl-incf deleted))
(when (eask-delete-file packaged) (cl-incf deleted))
(when (and (not (zerop deleted)) (directory-empty-p path))
(when (and (not (zerop deleted)) (eask-directory-empty-p path))
(eask-with-progress
(format "The dist folder %s seems to be empty, delete it as well... " path)
(ignore-errors (delete-directory path))
Expand Down
2 changes: 1 addition & 1 deletion lisp/clean/log-file.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(dolist (log-file log-files)
(when (eask-delete-file (expand-file-name log-file path))
(cl-incf deleted)))
(when (and (not (zerop deleted)) (directory-empty-p path))
(when (and (not (zerop deleted)) (eask-directory-empty-p path))
(eask-with-progress
(format "The dist folder %s seems to be empty, delete it as well... " path)
(ignore-errors (delete-directory path))
Expand Down
2 changes: 1 addition & 1 deletion lisp/extern/compat.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
(defun directory-empty-p (dir)
"..."
(and (file-directory-p dir)
(null (directory-files dir nil directory-files-no-dot-files-regexp t)))))
(null (directory-files dir nil directory-files-no-dot-files-regexp t 1)))))

;;; extern/compat.el ends here

0 comments on commit 3d8b65b

Please sign in to comment.