Fix #3532: file API wouldn't work with TRAMP
This commit is contained in:
parent
8e83a8e842
commit
cf39d7ed59
1 changed files with 9 additions and 12 deletions
|
@ -28,8 +28,7 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
|
||||||
(mapcar (doom-rpartial #'doom--resolve-path-forms directory)
|
(mapcar (doom-rpartial #'doom--resolve-path-forms directory)
|
||||||
(cdr spec)))
|
(cdr spec)))
|
||||||
(let ((filevar (make-symbol "file")))
|
(let ((filevar (make-symbol "file")))
|
||||||
`(let* ((file-name-handler-alist nil)
|
`(let ((,filevar ,spec))
|
||||||
(,filevar ,spec))
|
|
||||||
(and (stringp ,filevar)
|
(and (stringp ,filevar)
|
||||||
,(if directory
|
,(if directory
|
||||||
`(let ((default-directory ,directory))
|
`(let ((default-directory ,directory))
|
||||||
|
@ -38,21 +37,19 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
|
||||||
,filevar)))))
|
,filevar)))))
|
||||||
|
|
||||||
(defun doom--path (&rest segments)
|
(defun doom--path (&rest segments)
|
||||||
(let (file-name-handler-alist)
|
(let ((dir (pop segments)))
|
||||||
(let ((dir (pop segments)))
|
(unless segments
|
||||||
(unless segments
|
(setq dir (expand-file-name dir)))
|
||||||
(setq dir (expand-file-name dir)))
|
(while segments
|
||||||
(while segments
|
(setq dir (expand-file-name (car segments) dir)
|
||||||
(setq dir (expand-file-name (car segments) dir)
|
segments (cdr segments)))
|
||||||
segments (cdr segments)))
|
dir))
|
||||||
dir)))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-glob (&rest segments)
|
(defun doom-glob (&rest segments)
|
||||||
"Construct a path from SEGMENTS and expand glob patterns.
|
"Construct a path from SEGMENTS and expand glob patterns.
|
||||||
Returns nil if the path doesn't exist."
|
Returns nil if the path doesn't exist."
|
||||||
(let* (case-fold-search
|
(let* (case-fold-search
|
||||||
file-name-handler-alist
|
|
||||||
(dir (apply #'doom--path segments)))
|
(dir (apply #'doom--path segments)))
|
||||||
(if (string-match-p "[[*?]" dir)
|
(if (string-match-p "[[*?]" dir)
|
||||||
(file-expand-wildcards dir t)
|
(file-expand-wildcards dir t)
|
||||||
|
@ -105,7 +102,7 @@ be relative to it.
|
||||||
The search recurses up to DEPTH and no further. DEPTH is an integer.
|
The search recurses up to DEPTH and no further. DEPTH is an integer.
|
||||||
|
|
||||||
MATCH is a string regexp. Only entries that match it will be included."
|
MATCH is a string regexp. Only entries that match it will be included."
|
||||||
(let (result file-name-handler-alist)
|
(let (result)
|
||||||
(dolist (file (mapcan (doom-rpartial #'doom-glob "*") (doom-enlist paths)))
|
(dolist (file (mapcan (doom-rpartial #'doom-glob "*") (doom-enlist paths)))
|
||||||
(cond ((file-directory-p file)
|
(cond ((file-directory-p file)
|
||||||
(appendq!
|
(appendq!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue