check-declare.el: Use compilation-style warnings
* lisp/emacs-lisp/check-declare.el (check-declare-warn): Add file-line-column info to the warning. (check-declare-files): Make sure that `check-declare-warning-buffer' is in `compilation-mode'. Make the order of the errors that same as in the file. Add code to ensure that `first-error' will work properly.
This commit is contained in:
parent
26b2e9aa4d
commit
383722dee7
2 changed files with 39 additions and 8 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2015-02-25 Oleh Krehel <ohwoeowho@gmail.com>
|
||||||
|
|
||||||
|
* emacs-lisp/check-declare.el (check-declare-warn): Use
|
||||||
|
compilation-style warnings.
|
||||||
|
(check-declare-files): Make sure that
|
||||||
|
`check-declare-warning-buffer' is in `compilation-mode'.
|
||||||
|
|
||||||
2015-02-25 Oleh Krehel <ohwoeowho@gmail.com>
|
2015-02-25 Oleh Krehel <ohwoeowho@gmail.com>
|
||||||
|
|
||||||
* emacs-lisp/check-declare.el (check-declare-ext-errors): New
|
* emacs-lisp/check-declare.el (check-declare-ext-errors): New
|
||||||
|
|
|
@ -260,12 +260,29 @@ Returned list has elements FNFILE (FILE ...)."
|
||||||
"Warn that FILE made a false claim about FN in FNFILE.
|
"Warn that FILE made a false claim about FN in FNFILE.
|
||||||
TYPE is a string giving the nature of the error. Warning is displayed in
|
TYPE is a string giving the nature of the error. Warning is displayed in
|
||||||
`check-declare-warning-buffer'."
|
`check-declare-warning-buffer'."
|
||||||
(display-warning 'check-declare
|
(let ((warning-prefix-function
|
||||||
(format "%s said `%s' was defined in %s: %s"
|
(lambda (level entry)
|
||||||
(file-name-nondirectory file) fn
|
(let ((line 0)
|
||||||
(file-name-nondirectory fnfile)
|
(col 0))
|
||||||
type)
|
(insert
|
||||||
nil check-declare-warning-buffer))
|
(with-current-buffer (find-file-noselect file)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(when (re-search-forward
|
||||||
|
(format "(declare-function[ \t\n]+%s" fn) nil t)
|
||||||
|
(goto-char (match-beginning 0))
|
||||||
|
(setq line (line-number-at-pos))
|
||||||
|
(setq col (1+ (current-column))))
|
||||||
|
(format "%s:%d:%d:"
|
||||||
|
(file-name-nondirectory file)
|
||||||
|
line col))))
|
||||||
|
entry))
|
||||||
|
(warning-fill-prefix " "))
|
||||||
|
(display-warning 'check-declare
|
||||||
|
(format "%s said `%s' was defined in %s: %s"
|
||||||
|
(file-name-nondirectory file) fn
|
||||||
|
(file-name-nondirectory fnfile)
|
||||||
|
type)
|
||||||
|
nil check-declare-warning-buffer)))
|
||||||
|
|
||||||
(defun check-declare-files (&rest files)
|
(defun check-declare-files (&rest files)
|
||||||
"Check veracity of all `declare-function' statements in FILES.
|
"Check veracity of all `declare-function' statements in FILES.
|
||||||
|
@ -278,13 +295,20 @@ Return a list of any errors found."
|
||||||
(dolist (e (check-declare-sort alist))
|
(dolist (e (check-declare-sort alist))
|
||||||
(if (setq err (check-declare-verify (car e) (cdr e)))
|
(if (setq err (check-declare-verify (car e) (cdr e)))
|
||||||
(setq errlist (cons (cons (car e) err) errlist))))
|
(setq errlist (cons (cons (car e) err) errlist))))
|
||||||
|
(setq errlist (nreverse errlist))
|
||||||
(if (get-buffer check-declare-warning-buffer)
|
(if (get-buffer check-declare-warning-buffer)
|
||||||
(kill-buffer check-declare-warning-buffer))
|
(kill-buffer check-declare-warning-buffer))
|
||||||
|
(with-current-buffer (get-buffer-create check-declare-warning-buffer)
|
||||||
|
(unless (derived-mode-p 'compilation-mode)
|
||||||
|
(compilation-mode))
|
||||||
|
(let ((inhibit-read-only t))
|
||||||
|
(insert "\f\n"))
|
||||||
|
(compilation-forget-errors))
|
||||||
;; Sort back again so that errors are ordered by the files
|
;; Sort back again so that errors are ordered by the files
|
||||||
;; containing the declare-function statements.
|
;; containing the declare-function statements.
|
||||||
(dolist (e (check-declare-sort errlist))
|
(dolist (e (check-declare-sort errlist))
|
||||||
(dolist (f (cdr e))
|
(dolist (f (cdr e))
|
||||||
(check-declare-warn (car e) (cadr f) (car f) (nth 2 f))))
|
(check-declare-warn (car e) (cadr f) (car f) (nth 2 f))))
|
||||||
errlist))
|
errlist))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue