|
From: | Stefan Monnier |
Subject: | Re: master 2ab66c9: Replace project-kill-buffers-ignores with project-kill-buffer-conditions |
Date: | Tue, 28 Jul 2020 19:10:34 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> +(defun project--kill-buffer-check (buf conditions) > + "Check if buffer BUF matches any element of the list CONDITIONS. > +See `project-kill-buffer-conditions' for more details on the form > +of CONDITIONS." > + (catch 'kill > + (dolist (c conditions) > + (when (cond > + ((stringp c) > + (string-match-p c (buffer-name buf))) > + ((symbolp c) > + (funcall c buf)) > + ((eq (car-safe c) 'major-mode) > + (eq (buffer-local-value 'major-mode buf) > + (cdr c))) > + ((eq (car-safe c) 'derived-mode) > + (provided-mode-derived-p > + (buffer-local-value 'major-mode buf) > + (cdr c))) > + ((eq (car-safe c) 'not) > + (not (project--kill-buffer-check buf (cdr c)))) > + ((eq (car-safe c) 'or) > + (project--kill-buffer-check buf (cdr c))) > + ((eq (car-safe c) 'and) > + (seq-every-p > + (apply-partially #'project--kill-buffer-check > + buf) > + (mapcar #'list (cdr c))))) > + (throw 'kill t))))) Why do we need to invent a small language for that? Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |