diff options
| author | Miles Liu <miles@bung.cc> | 2022-10-26 16:48:37 +0800 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar@batsov.dev> | 2022-10-27 18:29:40 +0300 |
| commit | f5a2a3ab268b905c796de255e04790e6e69a61ab (patch) | |
| tree | afbbea19c91cf64099f39aefa28f0991106d27fc /projectile.el | |
| parent | 18b48d7faa27a3113558e389a60d912e739d0526 (diff) | |
[Fix #1804] Make it possible to ignore special project buffers
Diffstat (limited to 'projectile.el')
| -rw-r--r-- | projectile.el | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/projectile.el b/projectile.el index 8e8b34a..9041cd9 100644 --- a/projectile.el +++ b/projectile.el @@ -822,6 +822,27 @@ If the value is nil, there is no limit to the opend buffers count." :type 'integer :package-version '(projectile . "2.2.0")) +(defcustom projectile-ignore-special-project-buffers t + "When t ignore special project buffers. + +See `projectile-ignored-project-buffers'." + :group 'projectile + :type 'boolean + :package-version '(projectile . "2.7.0")) + +(defcustom projectile-ignored-project-buffers + '( + "*scratch*" ; Lisp Interaction Buffer + "*lsp-log*" ; LSP Mode Troubleshooting Buffer + ) + "A list of buffers considered that should never be killed or +associated with any specific project. + +See `projectile-ignore-special-project-buffers'." + :group 'projectile + :type '(repeat string) + :package-version '(projectile . "2.7.0")) + (defvar projectile-project-test-suffix nil "Use this variable to override the current project's test-suffix property. It takes precedence over the test-suffix for the project type when set. @@ -1641,12 +1662,22 @@ If PROJECT is not specified the command acts on the current project." default-directory))) (and (not (string-prefix-p " " (buffer-name buffer))) (not (projectile-ignored-buffer-p buffer)) + (not (projectile-ignored-project-buffers-p buffer)) directory (string-equal (file-remote-p directory) (file-remote-p project-root)) (not (string-match-p "^http\\(s\\)?://" directory)) (string-prefix-p project-root (file-truename directory) (eq system-type 'windows-nt)))))) +(defun projectile-ignored-project-buffers-p (buffer) + "Check if BUFFER should never associated with any specific project" + (when projectile-ignore-special-project-buffers + (with-current-buffer buffer + (cl-some + (lambda (name) + (string-match-p name (buffer-name))) + projectile-ignored-project-buffers)))) + (defun projectile-ignored-buffer-p (buffer) "Check if BUFFER should be ignored. |
