From 1c1ff3bfd12161d14f791658e22481acf9549109 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 9 Sep 2022 23:56:24 +0200 Subject: [PATCH] Accept "-w" as safe value for vc-git-annotate-switches * lisp/vc/vc-git.el (vc-git-annotate-switches-safe-p): New predicate function. (vc-git-annotate-switches): Use above new predicate function to check if it's :safe. --- lisp/vc/vc-git.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 9dfdd9e7b13..2941cc75beb 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -119,6 +119,14 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (repeat :tag "Argument List" :value ("") string)) :version "23.1") +;;;###autoload +(defun vc-git-annotate-switches-safe-p (switches) + "Check if local value of `vc-git-annotate-switches' is safe. +Currently only \"-w\" (ignore whitespace) is considered safe, but +this list might be extended in the future." + ;; TODO: Probably most options are perfectly safe. + (equal switches "-w")) + (defcustom vc-git-annotate-switches nil "String or list of strings specifying switches for Git blame under VC. If nil, use the value of `vc-annotate-switches'. If t, use no switches." @@ -127,6 +135,7 @@ If nil, use the value of `vc-annotate-switches'. If t, use no switches." (string :tag "Argument String") (repeat :tag "Argument List" :value ("") string)) :version "25.1") +;;;###autoload(put 'vc-git-annotate-switches 'safe-local-variable #'vc-git-annotate-switches-safe-p) (defcustom vc-git-log-switches nil "String or list of strings specifying switches for Git log under VC." -- 2.39.2