diff options
author | João Távora <joaotavora@gmail.com> | 2017-10-01 13:30:38 +0100 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2017-10-03 14:18:55 +0100 |
commit | 30ea272fe472ed77eab40179f43bb7bee5184912 (patch) | |
tree | d9f10b68676c1d0bc13ad4a242ffe41fccb4dde7 /lisp/progmodes | |
parent | 2e84179a291c6fce57d5e6c44121d77160487615 (diff) | |
download | emacs-30ea272fe472ed77eab40179f43bb7bee5184912.tar.gz emacs-30ea272fe472ed77eab40179f43bb7bee5184912.tar.bz2 emacs-30ea272fe472ed77eab40179f43bb7bee5184912.zip |
Hook Flymake onto proper checkdoc and byte-compile interfaces
The interfaces in bytecomp.el and checkdoc.el are mostly boilerplate,
with little knowledge of actual internals or thought given to the
usefulness of said interfaces in contexts other than Flymake's.
* lisp/emacs-lisp/bytecomp.el
(byte-compile-log-warning-function): New variable.
(byte-compile-log-warning): Use it.
(byte-compile--log-warning-for-byte-compile): New function.
* lisp/emacs-lisp/checkdoc.el
(checkdoc-create-error-function): New variable.
(checkdoc-create-error): Use it.
(checkdoc--create-error-for-checkdoc): New function.xo
* lisp/progmodes/flymake-elisp.el (flymake-elisp--checkdoc-1):
Use checkdoc-create-error-function.
(flymake-elisp--batch-byte-compile): Use
byte-compile-log-warning-function.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/flymake-elisp.el | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lisp/progmodes/flymake-elisp.el b/lisp/progmodes/flymake-elisp.el index b42767c3fac..b433dc24e12 100644 --- a/lisp/progmodes/flymake-elisp.el +++ b/lisp/progmodes/flymake-elisp.el @@ -32,18 +32,18 @@ (defun flymake-elisp--checkdoc-1 () "Do actual work for `flymake-elisp-checkdoc'." (let (collected) - (cl-letf (((symbol-function 'checkdoc-create-error) - (lambda (text start end &optional unfixable) - (push (list text start end unfixable) collected) - nil))) - (let* ((checkdoc-autofix-flag nil) - (checkdoc-generate-compile-warnings-flag nil) - (buf (generate-new-buffer " *checkdoc-temp*")) - (checkdoc-diagnostic-buffer buf)) - (unwind-protect - (save-excursion - (checkdoc-current-buffer t)) - (kill-buffer buf)))) + (let* ((checkdoc-create-error-function + (lambda (text start end &optional unfixable) + (push (list text start end unfixable) collected) + nil)) + (checkdoc-autofix-flag nil) + (checkdoc-generate-compile-warnings-flag nil) + (buf (generate-new-buffer " *checkdoc-temp*")) + (checkdoc-diagnostic-buffer buf)) + (unwind-protect + (save-excursion + (checkdoc-current-buffer t)) + (kill-buffer buf))) collected)) ;;;###autoload @@ -165,14 +165,14 @@ Runs in a batch-mode Emacs. Interactively use variable (byte-compile-dest-file-function (lambda (source) (setq dummy-elc-file (make-temp-file (file-name-nondirectory source))))) - (collected)) + (collected) + (byte-compile-log-warning-function + (lambda (string &optional position fill level) + (push (list string position fill level) + collected) + t))) (unwind-protect - (cl-letf (((symbol-function 'byte-compile-log-warning) - (lambda (string &optional fill level) - (push (list string byte-compile-last-position fill level) - collected) - t))) - (byte-compile-file file)) + (byte-compile-file file) (ignore-errors (delete-file dummy-elc-file) (kill-buffer byte-compile-log-buffer))) |