diff options
| author | Dmitry Gutov | 2019-02-07 14:22:47 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2019-02-07 14:22:47 +0300 |
| commit | 3d6d8d795b593df3fa2132e23811ad1e94a58c05 (patch) | |
| tree | 85e523f74485d484f450906c997ca991dbf4b8ed | |
| parent | 84b79f6a07bf45a27815f4793a7ee79a6d3610b3 (diff) | |
| download | emacs-3d6d8d795b593df3fa2132e23811ad1e94a58c05.tar.gz emacs-3d6d8d795b593df3fa2132e23811ad1e94a58c05.zip | |
Avoid unnecessary consing in project--files-in-directory
* lisp/progmodes/project.el (project--remote-file-names): New function.
(project--files-in-directory): Use it.
| -rw-r--r-- | lisp/progmodes/project.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 3906f6cb24b..fbf761c60c9 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -192,7 +192,6 @@ to find the list of ignores for each directory." | |||
| 192 | (require 'find-dired) | 192 | (require 'find-dired) |
| 193 | (defvar find-name-arg) | 193 | (defvar find-name-arg) |
| 194 | (let ((default-directory dir) | 194 | (let ((default-directory dir) |
| 195 | (remote-id (file-remote-p dir)) | ||
| 196 | (command (format "%s %s %s -type f %s -print0" | 195 | (command (format "%s %s %s -type f %s -print0" |
| 197 | find-program | 196 | find-program |
| 198 | (file-local-name dir) | 197 | (file-local-name dir) |
| @@ -209,8 +208,17 @@ to find the list of ignores for each directory." | |||
| 209 | " " | 208 | " " |
| 210 | (shell-quote-argument ")"))"") | 209 | (shell-quote-argument ")"))"") |
| 211 | ))) | 210 | ))) |
| 212 | (mapcar (lambda (file) (concat remote-id file)) | 211 | (project--remote-file-names |
| 213 | (split-string (shell-command-to-string command) "\0" t)))) | 212 | (split-string (shell-command-to-string command) "\0" t)))) |
| 213 | |||
| 214 | (defun project--remote-file-names (local-files) | ||
| 215 | "Return LOCAL-FILES as if they were on the system of `default-directory'." | ||
| 216 | (let ((remote-id (file-remote-p default-directory))) | ||
| 217 | (if (not remote-id) | ||
| 218 | local-files | ||
| 219 | (mapcar (lambda (file) | ||
| 220 | (concat remote-id file)) | ||
| 221 | local-files)))) | ||
| 214 | 222 | ||
| 215 | (defgroup project-vc nil | 223 | (defgroup project-vc nil |
| 216 | "Project implementation using the VC package." | 224 | "Project implementation using the VC package." |