Avoid mapping file names through 'substring'
* lisp/progmodes/project.el (project--files-in-directory): Avoid mapping file names through 'substring'. Reducing the amount of garbage generated. Better perf by up to 20%. Bump the package version.
This commit is contained in:
parent
bcce93f04c
commit
6bf29072e9
1 changed files with 15 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
;;; project.el --- Operations on the current project -*- lexical-binding: t; -*-
|
;;; project.el --- Operations on the current project -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
;; Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||||
;; Version: 0.8.0
|
;; Version: 0.8.1
|
||||||
;; Package-Requires: ((emacs "26.1") (xref "1.0.2"))
|
;; Package-Requires: ((emacs "26.1") (xref "1.0.2"))
|
||||||
|
|
||||||
;; This is a GNU ELPA :core package. Avoid using functionality that
|
;; This is a GNU ELPA :core package. Avoid using functionality that
|
||||||
|
@ -316,16 +316,21 @@ to find the list of ignores for each directory."
|
||||||
" "
|
" "
|
||||||
(shell-quote-argument ")"))
|
(shell-quote-argument ")"))
|
||||||
"")))
|
"")))
|
||||||
(output (with-output-to-string
|
res)
|
||||||
(with-current-buffer standard-output
|
(with-temp-buffer
|
||||||
(let ((status
|
(let ((status
|
||||||
(process-file-shell-command command nil t)))
|
(process-file-shell-command command nil t))
|
||||||
|
(pt (point-min)))
|
||||||
(unless (zerop status)
|
(unless (zerop status)
|
||||||
(error "File listing failed: %s" (buffer-string))))))))
|
(error "File listing failed: %s" (buffer-string)))
|
||||||
|
(goto-char pt)
|
||||||
|
(while (search-forward "\0" nil t)
|
||||||
|
(push (buffer-substring-no-properties (1+ pt) (1- (point)))
|
||||||
|
res)
|
||||||
|
(setq pt (point)))))
|
||||||
(project--remote-file-names
|
(project--remote-file-names
|
||||||
(mapcar (lambda (s) (concat dfn (substring s 1)))
|
(mapcar (lambda (s) (concat dfn s))
|
||||||
(sort (split-string output "\0" t)
|
(sort res #'string<)))))
|
||||||
#'string<)))))
|
|
||||||
|
|
||||||
(defun project--remote-file-names (local-files)
|
(defun project--remote-file-names (local-files)
|
||||||
"Return LOCAL-FILES as if they were on the system of `default-directory'.
|
"Return LOCAL-FILES as if they were on the system of `default-directory'.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue