diff options
author | Eli Zaretskii <eliz@gnu.org> | 2015-12-03 16:59:42 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2015-12-03 16:59:42 +0200 |
commit | eca277f937f4c51b83fa0f156b8081e88ea3f121 (patch) | |
tree | d762076988dc63596a07161e60924ea9d8e157d8 /lisp/files.el | |
parent | 4d10a7d467b6b0927036387c0d4849b2f40abcee (diff) | |
download | emacs-eca277f937f4c51b83fa0f156b8081e88ea3f121.tar.gz |
Fix documentation and implementation of 'directory-name-p'
* lisp/files.el (directory-name-p): Modify to recognize
backslashes on MS-Windows and MS-DOS. Adjust the doc string
accordingly. Use '=', not char-equal, for comparison, as
letter-case cannot possibly be an issue here.
* doc/lispref/files.texi (Directory Names): Move the documentation
of directory-name-p here from "Relative File Names". Update the
description per the changes in implementation.
* etc/NEWS: Move the entry for 'directory-name-p' to its proper
place and mark it documented.
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el index f37c23b7bdd..d20bb1401fa 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -740,9 +740,14 @@ The path separator is colon in GNU and GNU-like systems." (error "No such directory found via CDPATH environment variable")))) (defsubst directory-name-p (name) - "Return non-nil if NAME ends with a slash character." - (and (> (length name) 0) - (char-equal (aref name (1- (length name))) ?/))) + "Return non-nil if NAME ends with a directory separator character." + (let ((len (length name)) + (lastc ?.)) + (if (> len 0) + (setq lastc (aref name (1- len)))) + (or (= lastc ?/) + (and (memq system-type '(windows-nt ms-dos)) + (= lastc ?\\))))) (defun directory-files-recursively (dir regexp &optional include-directories) "Return list of all files under DIR that have file names matching REGEXP. |