mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-25 22:50:37 -08:00
Merge from origin/emacs-27
3f2788d4ac(origin/emacs-27) project--vc-list-files: Recurse into sub...f0da3aa83eMerge branch 'emacs-27' of git.savannah.gnu.org:/srv/git/e...3b199614ccMinor improvements of buffer documentatione1e0a7a751xref--collect-matches: Speed up on remote219b91eb2c; project--find-regexp-in-files: Avoid prepending remote-i...
This commit is contained in:
commit
01a0e17c80
3 changed files with 53 additions and 11 deletions
|
|
@ -13,6 +13,10 @@ the directory listing. If you send a message with @kbd{C-x m}, a
|
|||
buffer is used to hold the text of the message. When you ask for a
|
||||
command's documentation, that appears in a buffer named @file{*Help*}.
|
||||
|
||||
Buffers exist as long as they are in use, and are deleted
|
||||
(``killed'') when no longer needed, either by you (@pxref{Kill
|
||||
Buffer}) or by Emacs (e.g., when you exit Emacs, @pxref{Exiting}).
|
||||
|
||||
Each buffer has a unique name, which can be of any length. When a
|
||||
buffer is displayed in a window, its name is shown in the mode line
|
||||
(@pxref{Mode Line}). The distinction between upper and lower case
|
||||
|
|
|
|||
|
|
@ -262,8 +262,15 @@ backend implementation of `project-external-roots'.")
|
|||
|
||||
(defun project-try-vc (dir)
|
||||
(let* ((backend (ignore-errors (vc-responsible-backend dir)))
|
||||
(root (and backend (ignore-errors
|
||||
(vc-call-backend backend 'root dir)))))
|
||||
(root
|
||||
(pcase backend
|
||||
('Git
|
||||
;; Don't stop at submodule boundary.
|
||||
(or (vc-file-getprop dir 'project-git-root)
|
||||
(vc-file-setprop dir 'project-git-root
|
||||
(vc-find-root dir ".git/"))))
|
||||
('nil nil)
|
||||
(_ (ignore-errors (vc-call-backend backend 'root dir))))))
|
||||
(and root (cons 'vc root))))
|
||||
|
||||
(cl-defmethod project-roots ((project (head vc)))
|
||||
|
|
@ -303,7 +310,8 @@ backend implementation of `project-external-roots'.")
|
|||
(pcase backend
|
||||
(`Git
|
||||
(let ((default-directory (expand-file-name (file-name-as-directory dir)))
|
||||
(args '("-z")))
|
||||
(args '("-z"))
|
||||
files)
|
||||
;; Include unregistered.
|
||||
(setq args (append args '("-c" "-o" "--exclude-standard")))
|
||||
(when extra-ignores
|
||||
|
|
@ -315,11 +323,26 @@ backend implementation of `project-external-roots'.")
|
|||
(format ":!/:%s" (substring i 2))
|
||||
(format ":!:%s" i)))
|
||||
extra-ignores)))))
|
||||
(mapcar
|
||||
(lambda (file) (concat default-directory file))
|
||||
(split-string
|
||||
(apply #'vc-git--run-command-string nil "ls-files" args)
|
||||
"\0" t))))
|
||||
(setq files
|
||||
(mapcar
|
||||
(lambda (file) (concat default-directory file))
|
||||
(split-string
|
||||
(apply #'vc-git--run-command-string nil "ls-files" args)
|
||||
"\0" t)))
|
||||
;; Unfortunately, 'ls-files --recurse-submodules' conflicts with '-o'.
|
||||
(let* ((submodules (project--git-submodules))
|
||||
(sub-files
|
||||
(mapcar
|
||||
(lambda (module)
|
||||
(when (file-directory-p module)
|
||||
(project--vc-list-files
|
||||
(concat default-directory module)
|
||||
backend
|
||||
extra-ignores)))
|
||||
submodules)))
|
||||
(setq files
|
||||
(apply #'nconc files sub-files)))
|
||||
files))
|
||||
(`Hg
|
||||
(let ((default-directory (expand-file-name (file-name-as-directory dir)))
|
||||
args)
|
||||
|
|
@ -337,6 +360,18 @@ backend implementation of `project-external-roots'.")
|
|||
(lambda (s) (concat default-directory s))
|
||||
(split-string (buffer-string) "\0" t)))))))
|
||||
|
||||
(defun project--git-submodules ()
|
||||
;; 'git submodule foreach' is much slower.
|
||||
(condition-case nil
|
||||
(with-temp-buffer
|
||||
(insert-file-contents ".gitmodules")
|
||||
(let (res)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "path *= *\\(.+\\)" nil t)
|
||||
(push (match-string 1) res))
|
||||
(nreverse res)))
|
||||
(file-missing nil)))
|
||||
|
||||
(cl-defmethod project-ignores ((project (head vc)) dir)
|
||||
(let* ((root (cdr project))
|
||||
backend)
|
||||
|
|
@ -485,7 +520,7 @@ pattern to search for."
|
|||
(buffer-substring (point-min) (line-end-position))))
|
||||
(while (re-search-forward grep-re nil t)
|
||||
(push (list (string-to-number (match-string line-group))
|
||||
(concat remote-id (match-string file-group))
|
||||
(match-string file-group)
|
||||
(buffer-substring-no-properties (point) (line-end-position)))
|
||||
hits)))
|
||||
(setq xrefs (xref--convert-hits (nreverse hits) regexp))
|
||||
|
|
|
|||
|
|
@ -1291,8 +1291,11 @@ Such as the current syntax table and the applied syntax properties."
|
|||
|
||||
(defun xref--collect-matches (hit regexp tmp-buffer)
|
||||
(pcase-let* ((`(,line ,file ,text) hit)
|
||||
(file (and file (concat (file-remote-p default-directory) file)))
|
||||
(buf (xref--find-buffer-visiting file))
|
||||
(remote-id (file-remote-p default-directory))
|
||||
(file (and file (concat remote-id file)))
|
||||
(buf (unless remote-id
|
||||
;; find-buffer-visiting is slow on remote.
|
||||
(xref--find-buffer-visiting file)))
|
||||
(syntax-needed (xref--regexp-syntax-dependent-p regexp)))
|
||||
(if buf
|
||||
(with-current-buffer buf
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue