`projectile-files-via-ext-command' caused Emacs suspend on `compile-goto-error'
Expected behavior
It should be quickly open target file.
Actual behavior
projectile-files-via-ext-command' caused Emacs suspend on compile-goto-error' for a long time until I have to press [C-g] many times to quit process.
Steps to reproduce the problem
I use extension rg command rg to search a string. Then in the *rg* result buffer, I press [Enter] key (which correspond to command compile-goto-error, then Emacs suspend for a long time.
Profiler report
Memory report:
11,030,969,355 99% - command-execute
11,030,969,355 99% - call-interactively
11,028,057,229 99% - funcall-interactively
11,026,935,676 99% - compile-goto-error
11,026,913,480 99% - next-error-internal
11,026,913,480 99% - compilation-next-error-function
11,026,913,480 99% - apply
11,026,913,480 99% - compilation-find-file
11,026,913,480 99% - apply
11,026,913,480 99% - compilation-find-file-projectile-find-compilation-buffer
11,026,894,040 99% - projectile-current-project-dirs
11,026,885,856 99% - projectile-project-dirs
11,026,885,856 99% - projectile-project-files
11,026,885,856 99% - projectile-dir-files-alien
11,026,885,856 99% - projectile-files-via-ext-command
11,026,885,835 99% - shell-command
11,026,885,835 99% - apply
11,026,885,835 99% - shell-command--shell-command-with-editor-mode
11,026,885,835 99% - #<compiled -0xa42f572addb7582>
11,026,884,811 99% call-process-shell-command
21 0% generate-new-buffer
8,184 0% - projectile-acquire-root
8,184 0% + projectile-project-root
11,256 0% + projectile-project-root
8,184 0% + projectile-project-p
22,196 0% + event-end
1,105,393 0% + execute-extended-command
16,160 0% + move-end-of-line
2,912,126 0% + byte-code
64,212 0% + redisplay_internal (C function)
648 0% + timer-event-handler
21 0% + #<compiled -0x2222a52d2f12599>
0 0% ...
CPU report:
2651 96% - command-execute
2651 96% - call-interactively
1624 59% - byte-code
1624 59% - read-extended-command
1624 59% + completing-read
1027 37% - funcall-interactively
1025 37% - compile-goto-error
1024 37% - next-error-internal
1024 37% - compilation-next-error-function
1024 37% - apply
1024 37% - compilation-find-file
1024 37% - apply
1024 37% - compilation-find-file-projectile-find-compilation-buffer
1019 37% - projectile-current-project-dirs
1017 37% - projectile-project-dirs
1017 37% - projectile-project-files
1017 37% - projectile-dir-files-alien
1017 37% - projectile-files-via-ext-command
1015 37% - shell-command
1015 37% - apply
1015 37% - shell-command--shell-command-with-editor-mode
1015 37% - #<compiled -0xa42f572addb7582>
1014 36% call-process-shell-command
1 0% make-temp-file
2 0% #<compiled -0x1dff179d6c8ea193>
2 0% + projectile-acquire-root
3 0% + projectile-project-root
2 0% + projectile-project-p
1 0% event-end
2 0% + execute-extended-command
51 1% + ...
32 1% + timer-event-handler
7 0% + redisplay_internal (C function)
Environment & Version information
- Emacs version: GNU Emacs 28.0.60 (build 1, aarch64-apple-darwin20.6.0, NS appkit-2022.60 Version 11.6 (Build 20G165)) of 2021-10-20
- projectile version: MELPA 20211116.700
Projectile version information
Include here the version string displayed by M-x projectile-version. Here's an example:
Projectile version: 2.6.0-snapshot
Emacs version
E.g. 24.5 (use C-h C-a to see it)
Operating system
macOS Big Sur
Does this happen for every project or for some specific project? Does it happens with grep/ag as well or is something that happens only for projectile-rg?
It happens on specific project. When I in small project (less files), it is fast. When I'm in very large project (I have a very big Org/ directory contains about N * 10000 files). I also installed ag and tried command projectile-ag. It's same slow and suspend too.
Same here, with a (old, huge) SVN repo: the "svn list -R ." command is super slow, making Emacs wait. Is there a way to disable this behaviour?
@fpatz You can use bellowing code to disable this advice function temporary.
(defun my/projectile-remove-compilation-find-file-advice ()
"Fix `compilation-mode' inherited modes caused suspend on opening `compile-goto-error', `next-error' etc targets."
(advice-remove 'compilation-find-file #'compilation-find-file-projectile-find-compilation-buffer))
(add-hook 'projectile-mode-hook #'my/projectile-remove-compilation-find-file-advice)