[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/relint eb178d5 06/21: Check assignments to imenu-generi
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/relint eb178d5 06/21: Check assignments to imenu-generic-expression |
Date: |
Sun, 3 May 2020 11:13:35 -0400 (EDT) |
branch: externals/relint
commit eb178d5f9d529ccc29785e277683faa661e73be4
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Check assignments to imenu-generic-expression
---
relint.el | 16 +++++++++++++++-
test/9.elisp | 5 +++++
test/9.expected | 3 +++
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/relint.el b/relint.el
index 0c1653d..31f1887 100644
--- a/relint.el
+++ b/relint.el
@@ -1152,6 +1152,14 @@ or in the car of an element."
(relint--check-re-string (car elem) ident file pos p)))))
form path))
+(defun relint--check-imenu-generic-expression (form name file pos path)
+ (relint--eval-list-iter
+ (lambda (elem elem-path literal)
+ (when (and (consp elem) (consp (cdr elem)) (stringp (cadr elem)))
+ (relint--check-re-string
+ (cadr elem) name file pos (if literal (cons 1 elem-path) elem-path))))
+ form path))
+
(defun relint--check-compilation-error-regexp-alist-alist (form name
file pos path)
(relint--eval-list-iter
@@ -1701,6 +1709,9 @@ directly."
((memq name '(font-lock-defaults font-lock-keywords))
(relint--check-font-lock-keywords expr name
file pos (cons i path)))
+ ((eq name 'imenu-generic-expression)
+ (relint--check-imenu-generic-expression
+ expr name file pos (cons i path)))
(t
;; Invalidate the variable if it was local; otherwise, ignore.
(let ((local (assq name relint--locals)))
@@ -1948,7 +1959,10 @@ directly."
(relint--check-re expr name file pos (cons 2 path)))
((memq name '(font-lock-defaults font-lock-keywords))
(relint--check-font-lock-keywords expr name
- file pos (cons 2 path)))))
+ file pos (cons 2 path)))
+ ((eq name 'imenu-generic-expression)
+ (relint--check-imenu-generic-expression
+ expr name file pos (cons 2 path)))))
(`(define-generic-mode ,name ,_ ,_ ,font-lock-list ,auto-mode-list . ,_)
(let ((origin (format "define-generic-mode %s" name)))
(relint--check-font-lock-keywords font-lock-list origin
diff --git a/test/9.elisp b/test/9.elisp
index 322334f..4a37174 100644
--- a/test/9.elisp
+++ b/test/9.elisp
@@ -23,3 +23,8 @@
(setq-local font-lock-defaults '(("[mm]" . tag)))
(setq font-lock-defaults '(("[nn]" . tag)))
(set (make-local-variable 'font-lock-defaults) '(("[oo]" . tag))))
+
+(defun test-9-ge ()
+ (setq-local imenu-generic-expression
+ '((nil "oh" 0)
+ ("*more*" "+a+" 0))))
diff --git a/test/9.expected b/test/9.expected
index ab3f06e..7bab898 100644
--- a/test/9.expected
+++ b/test/9.expected
@@ -43,3 +43,6 @@
9.elisp:25:56: In font-lock-defaults (tag): Duplicated `o' inside character
alternative (pos 2)
"[oo]"
..^
+9.elisp:30:28: In imenu-generic-expression: Unescaped literal `+' (pos 0)
+ "+a+"
+ ^
- [elpa] externals/relint updated (83e677d -> a001a05), Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 96e26a5 02/21: Check keyword arguments :regexp and :regex, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint ba7b747 01/21: Display the number of files found in relint-directory, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint b694c09 07/21: Check split ASCII-raw ranges in rx correctly, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 12a2b0f 08/21: Use regexp in suppression comments, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 9259a5c 03/21: Check some :value parameters in defcustom :type clauses, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint ac75b62 04/21: Check rx-to-string, and the 'regexp' and 'eval' subforms, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 09ef3df 05/21: Describe the new xr wrapped subsumption warning, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint eb178d5 06/21: Check assignments to imenu-generic-expression,
Mattias Engdegård <=
- [elpa] externals/relint 2eba4d7 09/21: Describe new bol/eol/eos warnings, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint cf2a2ae 14/21: Do file-specific checks on arguments to known functions, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint f6d0fed 15/21: Describe the new file-specific warnings, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 1bf7f25 13/21: Check auto-mode-alist with file-specific checks, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 4fcc322 16/21: Delay call to file-relative-name until needed, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 326cfe2 11/21: Check calls to directory-files(-and-attributes), Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 5d3f78d 19/21: Update xr messages ("repetition" changed to "option"), Mattias Engdegård, 2020/05/03
- [elpa] externals/relint a50ed0b 20/21: Don't escape printable chars in rx warnings, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint cdd65ae 10/21: Add section about how relint works, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 636e172 12/21: Add filename-specific checks (unused so far), Mattias Engdegård, 2020/05/03