From d6aa19b638a89d1144d9ee1596943f6b42faf5da Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 27 Jun 2019 17:17:04 +0200 Subject: [PATCH] Suppress error from projectile-default-generic-command Caused when using projectile-{run,test,compile,configure}-project commands in a project that projectile cannot recognize (i.e. doesn't match any project in projectile-project-types). --- core/core-projects.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/core-projects.el b/core/core-projects.el index 30cc6588f..c97392aba 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -46,6 +46,17 @@ Emacs.") (push ".project" projectile-project-root-files-bottom-up) (push (abbreviate-file-name doom-local-dir) projectile-globally-ignored-directories) + (defun doom*projectile-default-generic-command (orig-fn &rest args) + "If projectile can't tell what kind of project you're in, it issues an error +when using many of projectile's command, e.g. `projectile-compile-command', +`projectile-run-project', `projectile-test-project', and +`projectile-configure-project', for instance. + +This suppresses the error so these commands will still run, but prompt you for +the command instead." + (ignore-errors (apply orig-fn args))) + (advice-add #'projectile-default-generic-command :around #'doom*projectile-default-generic-command) + ;; Accidentally indexing big directories like $HOME or / will massively bloat ;; projectile's cache (into the hundreds of MBs). This purges those entries ;; when exiting Emacs to prevent slowdowns/freezing when cache files are