emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/etags-regen 4df82d1: Avoid unsafe value prompts when the package


From: Dmitry Gutov
Subject: scratch/etags-regen 4df82d1: Avoid unsafe value prompts when the package's not loaded
Date: Sun, 3 Jan 2021 20:22:34 -0500 (EST)

branch: scratch/etags-regen
commit 4df82d18aff1d7581fd63545c3c92bf172e89b36
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Avoid unsafe value prompts when the package's not loaded
---
 lisp/progmodes/etags-regen.el | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/lisp/progmodes/etags-regen.el b/lisp/progmodes/etags-regen.el
index c22ead8..74843e8 100644
--- a/lisp/progmodes/etags-regen.el
+++ b/lisp/progmodes/etags-regen.el
@@ -63,20 +63,22 @@ We support only Emacs's etags program with this option."
            (repeat (string :tag "Tag Regexp"))))
   :safe 'etags-regen--safe-regexp-alist-p)
 
-(defun etags-regen--safe-regexp-alist-p (value)
-  (and (listp value)
-       (seq-every-p
-        (lambda (group)
-          (and (consp group)
-               (listp (car group))
-               (listp (cdr group))
-               (seq-every-p
-                (lambda (lang)
-                  (and (stringp lang)
-                       (string-match-p "\\`[a-z*+]+\\'" lang)))
-                (car group))
-               (seq-every-p #'stringp (cdr group))))
-        value)))
+;;;###autoload
+(put 'etags-regen-lang-regexp-alist 'safe-local-variable
+     (lambda (value)
+       (and (listp value)
+            (seq-every-p
+             (lambda (group)
+               (and (consp group)
+                    (listp (car group))
+                    (listp (cdr group))
+                    (seq-every-p
+                     (lambda (lang)
+                       (and (stringp lang)
+                            (string-match-p "\\`[a-z*+]+\\'" lang)))
+                     (car group))
+                    (seq-every-p #'stringp (cdr group))))
+             value))))
 
 (defvar etags-regen--errors-buffer-name "*etags-regen-tags-errors*")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]