From a5e472b128d20cb960b7e557d4ee8815f36d043e Mon Sep 17 00:00:00 2001 From: Rowan Thorpe Date: Thu, 21 Sep 2017 22:42:46 +0300 Subject: [PATCH] Add standardfmt-lint function --- standardfmt.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/standardfmt.el b/standardfmt.el index 9ff38b8..a2813cd 100644 --- a/standardfmt.el +++ b/standardfmt.el @@ -58,6 +58,25 @@ :type 'string :group 'standardfmt) +(defun standardfmt-lint () + "Lint the current buffer with standard/semistandard." + (interactive) + (let ((msgbuf (get-buffer-create "*standardfmt-lint messages*")) + (coding-system-for-read 'utf-8) + (coding-system-for-write 'utf-8)) + + (save-restriction + (widen) + (with-current-buffer msgbuf (erase-buffer)) + + (message "Calling standard: %s -" + standardfmt-command) + + (if (zerop (call-process-region (point-min) (point-max) + standardfmt-command nil msgbuf t "-")) + (message "Buffer conforms to semistandard") + (message "Buffer doesn't conform to semistandard"))))) + (defun standardfmt () "Format the current buffer with standard/semistandard." (interactive)