From: Eshel Yaron Date: Mon, 20 Jan 2025 07:56:06 +0000 (+0100) Subject: scope.el,elisp-mode.el: Recognize warning types X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1d4e4124191c29b808c39a8d0f4af22478a28bb2;p=emacs.git scope.el,elisp-mode.el: Recognize warning types --- diff --git a/lisp/emacs-lisp/scope.el b/lisp/emacs-lisp/scope.el index e1e958966e3..f563159254c 100644 --- a/lisp/emacs-lisp/scope.el +++ b/lisp/emacs-lisp/scope.el @@ -982,6 +982,14 @@ a (possibly empty) list of safe macros.") ;; Never expand them! static-if eval-when-compile eval-and-compile)) (scope-n local forms)) + ((memq bare '(with-suppressed-warnings)) + (dolist (warning (car forms)) + (when-let* ((wsym (car-safe warning)) + (beg (scope-sym-pos wsym)) + (bare (scope-sym-bare wsym))) + (funcall scope-callback 'warning-type beg + (length (symbol-name bare)) nil))) + (scope-n local (cdr forms))) ((memq bare '(with-slots)) (scope-with-slots local (car forms) (cadr forms) (cddr forms))) ((memq bare '(ert-deftest)) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 39a6ed20ce6..61614007510 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -433,6 +433,7 @@ happens in interactive invocations." (macro "Macro call") (special-form "Special form") (throw-tag "`throw'/`catch' tag") + (warning-type "Warning type") (feature "Feature") (rx-construct "`rx' construct") (theme "Theme") @@ -457,6 +458,7 @@ happens in interactive invocations." (macro 'elisp-macro-call) (special-form 'elisp-special-form) (throw-tag 'elisp-throw-tag) + (warning-type 'font-lock-type-face) (feature 'elisp-feature) (rx-construct 'elisp-rx) (theme 'elisp-theme) @@ -909,6 +911,8 @@ in `completion-at-point-functions' (which see)." ((major-mode) (lambda (sym) (get sym 'major-mode-name))) ((type) (lambda (sym) (get sym 'cl--class))) ((widget-type) (lambda (sym) (get sym 'widget-type))) + ((warning-type) + (lambda (sym) (memq sym byte-compile-warning-types))) ((group) (lambda (sym) (get sym 'group-documentation))) ((face) #'facep) ((nil) (lambda (sym)