Skip to content

Commit fc21671

Browse files
committed
Update compatibility layer for relint for the current 2.0; make it more robust against future upstream changes.
1 parent 7da6690 commit fc21671

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

eldev.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Since 0.5")
325325
(ecukes :version "0.6.18" :archive melpa)
326326
;; Need GNU ELPA for `let-alist' on older Emacs versions.
327327
(package-lint :version "0.14" :archives (melpa gnu-elpa))
328-
(relint :version "1.18" :archive gnu-elpa)
328+
(relint :version "2.0" :archive gnu-elpa)
329329
;; Need GNU ELPA for `let-alist' on older Emacs versions.
330330
(elisp-lint :archives (melpa gnu-elpa))
331331
;; This is for a plugin, but probably no reason not to have it unconditionally.
@@ -5188,7 +5188,8 @@ least one warning."
51885188
(package-read-all-archive-contents))
51895189

51905190

5191-
(declare-function relint-file "relint")
5191+
(declare-function relint-file 'relint)
5192+
(declare-function relint-diag-severity 'relint)
51925193

51935194
(eldev-deflinter eldev-linter-re ()
51945195
"Find errors, deprecated syntax etc. in regular expressions."
@@ -5199,9 +5200,10 @@ least one warning."
51995200
(eldev-load-extra-dependencies 'runtime))
52005201
(eldev--require-external-feature 'relint)
52015202
;; I see no way to avoid diving into internals.
5202-
(eldev-advised ('relint--output-report :around (lambda (original error-buffer file complaint &rest etc)
5203-
(eldev-lint-printing-warning (if (eq (nth 5 complaint) 'error) :error :warning)
5204-
(apply original error-buffer file complaint etc))))
5203+
(eldev-advised ('relint--output-complaint :around (lambda (original &rest args)
5204+
;; Use `ignore-errors' to avoid dying if relint's internals change.
5205+
(eldev-lint-printing-warning (if (ignore-errors (eq (relint-diag-severity (nth 2 args)) 'error)) :error :warning)
5206+
(apply original args))))
52055207
;; Suppress totals from `relint' as we print them ourselves.
52065208
(eldev-advised ('relint--finish :around (lambda (original &rest arguments)
52075209
(let ((inhibit-message t))

0 commit comments

Comments
 (0)