From: Dmitry Gutov Date: Thu, 7 Feb 2019 11:22:47 +0000 (+0300) Subject: Avoid unnecessary consing in project--files-in-directory X-Git-Tag: emacs-27.0.90~3655 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3d6d8d795b593df3fa2132e23811ad1e94a58c05;p=emacs.git Avoid unnecessary consing in project--files-in-directory * lisp/progmodes/project.el (project--remote-file-names): New function. (project--files-in-directory): Use it. --- 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." (require 'find-dired) (defvar find-name-arg) (let ((default-directory dir) - (remote-id (file-remote-p dir)) (command (format "%s %s %s -type f %s -print0" find-program (file-local-name dir) @@ -209,8 +208,17 @@ to find the list of ignores for each directory." " " (shell-quote-argument ")"))"") ))) - (mapcar (lambda (file) (concat remote-id file)) - (split-string (shell-command-to-string command) "\0" t)))) + (project--remote-file-names + (split-string (shell-command-to-string command) "\0" t)))) + +(defun project--remote-file-names (local-files) + "Return LOCAL-FILES as if they were on the system of `default-directory'." + (let ((remote-id (file-remote-p default-directory))) + (if (not remote-id) + local-files + (mapcar (lambda (file) + (concat remote-id file)) + local-files)))) (defgroup project-vc nil "Project implementation using the VC package."