Skip to content

Commit

Permalink
Update compatibility layer for relint for the current 2.0; make it …
Browse files Browse the repository at this point in the history
…more robust against future upstream changes.
  • Loading branch information
doublep committed Oct 12, 2024
1 parent 7da6690 commit fc21671
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions eldev.el
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Since 0.5")
(ecukes :version "0.6.18" :archive melpa)
;; Need GNU ELPA for `let-alist' on older Emacs versions.
(package-lint :version "0.14" :archives (melpa gnu-elpa))
(relint :version "1.18" :archive gnu-elpa)
(relint :version "2.0" :archive gnu-elpa)
;; Need GNU ELPA for `let-alist' on older Emacs versions.
(elisp-lint :archives (melpa gnu-elpa))
;; This is for a plugin, but probably no reason not to have it unconditionally.
Expand Down Expand Up @@ -5188,7 +5188,8 @@ least one warning."
(package-read-all-archive-contents))


(declare-function relint-file "relint")
(declare-function relint-file 'relint)
(declare-function relint-diag-severity 'relint)

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

0 comments on commit fc21671

Please sign in to comment.