diff options
author | Oleh Krehel <ohwoeowho@gmail.com> | 2015-02-13 14:59:31 +0100 |
---|---|---|
committer | Oleh Krehel <ohwoeowho@gmail.com> | 2015-02-14 11:34:28 +0100 |
commit | ed9b01809687a2906dad41d63e2ab7e25acd55de (patch) | |
tree | 0edd6a45547f7f7f233e3e55f5575c43974d1e47 | |
parent | 3d0ac0f2ec1f645e6b009f2c1639904355d25a18 (diff) | |
download | emacs-ed9b01809687a2906dad41d63e2ab7e25acd55de.tar.gz |
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'.
-rw-r--r-- | lisp/ChangeLog | 7 | ||||
-rw-r--r-- | lisp/emacs-lisp/check-declare.el | 32 |
2 files changed, 33 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1ee515f643d..7ed7ef5faf8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2015-02-13 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-13 Oleh Krehel <ohwoeowho@gmail.com> + * emacs-lisp/check-declare.el (check-declare-ext-errors): New defcustom. (check-declare): New defgroup. diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 40ab03d8351..eef2e84b0f2 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -260,12 +260,29 @@ Returned list has elements FNFILE (FILE ...)." "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 `check-declare-warning-buffer'." - (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)) + (let ((warning-prefix-function + (lambda (level entry) + (let ((line 0) + (col 0)) + (insert + (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) "Check veracity of all `declare-function' statements in FILES. @@ -280,6 +297,9 @@ Return a list of any errors found." (setq errlist (cons (cons (car e) err) errlist)))) (if (get-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))) ;; Sort back again so that errors are ordered by the files ;; containing the declare-function statements. (dolist (e (check-declare-sort errlist)) |