[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Speed up project-kill-buffers
From: |
Stephen Leake |
Subject: |
Re: [PATCH] Speed up project-kill-buffers |
Date: |
Thu, 20 May 2021 05:16:46 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt) |
Stephen Leake <stephen_leake@stephe-leake.org> writes:
> Hmm. I just found project-kill-buffer-conditions; maybe I could
> customize that; it allows arbitrary predicate functions. It would be
> more efficient if the predicate function were also passed the project
> object, so it doesn't have to call project-current again (hmm - shades
> of project-delete-this-buffer-p :).
This works for wisi projects, but not for the elisp project (it signals
an error):
(defun wisi-prj-kill-buffer-condition (buffer)
"Return non-nil if BUFFER should be killed.
For `project-kill-buffer-conditions'."
(let* ((source-path (wisi-prj-source-path (project-current)))
(buf-file-name (buffer-file-name buffer))
(done (not (buffer-file-name buffer)))
(result nil)
dir)
(while (and source-path
(not done))
(setq dir (pop source-path))
(when (and dir
(file-in-directory-p buf-file-name dir))
(setq done t)
(setq result t)))
result))
(setq project-kill-buffer-conditions
(list #'wisi-prj-kill-buffer-condition))
I'm not clear how to set project-kill-buffer-conditions on a
per-project basis; it would be simple if this was a cl-defgeneric
dispatching on the project.
--
-- Stephe
- Re: [PATCH] Speed up project-kill-buffers, (continued)
- Re: [PATCH] Speed up project-kill-buffers, Stephen Leake, 2021/05/08
- Re: [PATCH] Speed up project-kill-buffers, Philip Kaludercic, 2021/05/08
- Re: [PATCH] Speed up project-kill-buffers, Philip Kaludercic, 2021/05/08
- Re: [PATCH] Speed up project-kill-buffers, Dmitry Gutov, 2021/05/08
- Re: [PATCH] Speed up project-kill-buffers, Dmitry Gutov, 2021/05/08
- Re: [PATCH] Speed up project-kill-buffers, Stephen Leake, 2021/05/16
- Re: [PATCH] Speed up project-kill-buffers, Dmitry Gutov, 2021/05/16
- Re: [PATCH] Speed up project-kill-buffers, Stephen Leake, 2021/05/19
- Re: [PATCH] Speed up project-kill-buffers,
Stephen Leake <=
- Re: [PATCH] Speed up project-kill-buffers, Dmitry Gutov, 2021/05/24
- Re: [PATCH] Speed up project-kill-buffers, Stephen Leake, 2021/05/30
- Re: [PATCH] Speed up project-kill-buffers, Dmitry Gutov, 2021/05/24
- Re: [PATCH] Speed up project-kill-buffers, Stephen Leake, 2021/05/30
Re: [PATCH] Speed up project-kill-buffers, Dmitry Gutov, 2021/05/03