From 9647ddb2993371de78d4058ecda7a741cac37d96 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 30 Aug 2023 19:42:58 +0200 Subject: [PATCH] Clean up some safe-local-variable predicates * lisp/progmodes/project.el: Add comments with a reminder to simplify 'safe-local-variable' predicates when Emacs 28 support is dropped. (project-vc-ignores): Mark only a list of strings as safe-local. * lisp/textmodes/reftex-vars.el (reftex-guess-label-type): Use booleanp for 'safe-local-variable' predicate. (Bug#65608) --- lisp/progmodes/project.el | 4 +++- lisp/textmodes/reftex-vars.el | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 7aaf7a9f9fb..37db677943a 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -410,7 +410,8 @@ the buffer's value of `default-directory'." (defcustom project-vc-ignores nil "List of patterns to add to `project-ignores'." :type '(repeat string)) -;;;###autoload(put 'project-vc-ignores 'safe-local-variable #'listp) +;; Change to `list-of-strings-p' when support for Emacs 28 is dropped. +;;;###autoload(put 'project-vc-ignores 'safe-local-variable (lambda (val) (and (listp val) (not (memq nil (mapcar #'stringp val)))))) (defcustom project-vc-merge-submodules t "Non-nil to consider submodules part of the parent project. @@ -465,6 +466,7 @@ variables, such as `project-vc-ignores' or `project-vc-name'." :type '(repeat string) :version "29.1" :package-version '(project . "0.9.0")) +;; Change to `list-of-strings-p' when support for Emacs 28 is dropped. ;;;###autoload(put 'project-vc-extra-root-markers 'safe-local-variable (lambda (val) (and (listp val) (not (memq nil (mapcar #'stringp val)))))) ;; FIXME: Using the current approach, major modes are supposed to set diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index ebe49ae9fef..a153bfb3ec3 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -1156,7 +1156,7 @@ immediately offer the correct label menu - otherwise it will prompt you for a label type. If you set this variable to nil, RefTeX will always prompt." :group 'reftex-referencing-labels :type 'boolean) -;;;###autoload(put 'reftex-guess-label-type 'safe-local-variable (lambda (x) (memq x '(nil t)))) +;;;###autoload(put 'reftex-guess-label-type 'safe-local-variable #'booleanp) (defcustom reftex-format-ref-function nil "Function which produces the string to insert as a reference. -- 2.39.5