From 0ee0d4b3937374c5df41119dc5460b7841c1ba50 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Mon, 18 Mar 2024 08:53:50 +0100 Subject: [PATCH] magit-disable-section-inserter: Allow several functions as arguments The function `magit-disable-section-inserter` is convenient in a .dir-locals.el file to disable a section per repository. When more than one section should be disabled, this function can be called several times. This commit makes disabling several sections easier by allowing more than one section as argument. --- lisp/magit-section.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/magit-section.el b/lisp/magit-section.el index c782ea6a59..18dbfe3ce7 100644 --- a/lisp/magit-section.el +++ b/lisp/magit-section.el @@ -2179,10 +2179,15 @@ again use `remove-hook'." (defun magit-disable-section-inserter (fn) "Disable the section inserter FN in the current repository. + +FN can be a single section inserter or a list of inserters. + It is only intended for use in \".dir-locals.el\" and \".dir-locals-2.el\". Also see info node `(magit)Per-Repository Configuration'." - (cl-pushnew fn magit-disabled-section-inserters)) + (unless (listp fn) (cl-callf list fn)) + (dolist (each fn) + (cl-pushnew each magit-disabled-section-inserters))) (put 'magit-disable-section-inserter 'safe-local-eval-function t)