[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 9c6818c 20/99: Add directory-name-p compatibilit
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 9c6818c 20/99: Add directory-name-p compatibility function |
Date: |
Sun, 17 Oct 2021 05:57:50 -0400 (EDT) |
branch: externals/compat
commit 9c6818c9d326e46c56a4832b4db804710fd50755
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add directory-name-p compatibility function
---
compat-25.1.el | 9 +++++++++
compat-tests.el | 16 ++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/compat-25.1.el b/compat-25.1.el
index 7621006..100e578 100644
--- a/compat-25.1.el
+++ b/compat-25.1.el
@@ -57,6 +57,15 @@ This implementation is equivalent to `format'."
;; TODO advise read-buffer to handle 4th argument
+;;;; Defined in fileio.c
+
+(compat-defun directory-name-p (name)
+ "Return non-nil if NAME ends with a directory separator character."
+ (eq (eval-when-compile
+ (if (memq system-type '(cygwin windows-nt ms-dos))
+ ?\\ ?/))
+ (aref name (1- (length name)))))
+
;;;; Defined in subr.el
(compat-defun string-greaterp (string1 string2)
diff --git a/compat-tests.el b/compat-tests.el
index ba54d41..e0c0f88 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1203,5 +1203,21 @@ the compatibility function."
(should (= (compat--named-let l ((i 0) (x 1)) (if (= i 8) x (l (1+ i) (* x
2))))
(expt 2 8))))
+(ert-deftest compat-directory-name-p ()
+ "Check if `directory-name-p' was implemented properly."
+ (compat-test directory-name-p
+ (compat--should t "/")
+ (compat--should nil "/file")
+ (compat--should nil "/dir/file")
+ (compat--should t "/dir/")
+ (compat--should nil "/dir")
+ (compat--should t "/dir/subdir/")
+ (compat--should nil "/dir/subdir")
+ (compat--should t "dir/")
+ (compat--should nil "file")
+ (compat--should nil "dir/file")
+ (compat--should t "dir/subdir/")
+ (compat--should nil "dir/subdir")))
+
(provide 'compat-tests)
;;; compat-tests.el ends here
- [elpa] externals/compat 20afc89 78/99: Add :cond checks to json-* functions in compat-27.1, (continued)
- [elpa] externals/compat 20afc89 78/99: Add :cond checks to json-* functions in compat-27.1, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 72c0781 81/99: Mention Chris Wellons' article on lambdas and byte compilation, ELPA Syncer, 2021/10/17
- [elpa] externals/compat ee068f0 82/99: Revert back to manual advising, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 7bef68b 84/99: Mark regexp-opt as part of regexp-opt.el, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 7619f21 89/99: Display version number of manual advice docstring, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 7245918 96/99: Fix handling of file-missing in require advice, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 29dc297 98/99: Ensure that compat-maxargs-/= is visible at compile time, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 61a1da1 44/99: Remove indirect-function compatibility, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 044acff 58/99: Optionally let compat-func-arity handle advice, ELPA Syncer, 2021/10/17
- [elpa] externals/compat a46ab78 19/99: Add button-buttonize to emacs-28.1, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 9c6818c 20/99: Add directory-name-p compatibility function,
ELPA Syncer <=
- [elpa] externals/compat 070384b 24/99: Fix compat-tests for older versions, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 05092cb 25/99: Fix compat-test indentation in compat-tests, ELPA Syncer, 2021/10/17
- [elpa] externals/compat cb339dd 31/99: Add :cond where applicable, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 2d50e5c 32/99: Implement func-arity, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 36ef438 35/99: Implement and use mounted-file-systems, ELPA Syncer, 2021/10/17
- [elpa] externals/compat e5a573f 37/99: Declare mouse-set-point, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 2089c90 41/99: Declare gensym for with-existing-directory, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 2faab78 42/99: Add debug specification for setq-local, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 5e7698c 45/99: Avoid testing advice compatibility in version to old to compare, ELPA Syncer, 2021/10/17
- [elpa] externals/compat 343bcbb 46/99: Fix if-let implementation, ELPA Syncer, 2021/10/17