Hi all, I've been playing with using flycheck to highlight MLINT warnings/errors rather than the existing code in mlint.el. flycheck is a popular and robust package for code checkers and it would be great to support in matlab-mode. So I'm writing to propose adding it to the matlab.el distribution.
The code I've been using is at the end of this message. Some open questions I have: 1. What's the best way to integrate with matlab-mode? Right now I just turn off the current mlint highlighting in the setup function: (defun flycheck-matlab-mlint-setup () "Set up Flycheck MATLAB mlint. Adds `matlab-mlint' to `flycheck-checkers'. NOTE: This disables showing warnings with the matlab-mode mlint integration" (interactive) (add-to-list 'flycheck-checkers 'matlab-mlint) (eval-after-load 'matlab '(setq matlab-show-mlint-warnings nil))) 2. How could we integrate this with the mlint.el heuristics for finding the mlint executable? Right now a user has to set flycheck-matlab-mlint-executable. Maybe this could be more automated. Aside from that, I've really liked flycheck integration as it provides many niceties and will continue to provide more as the underlying infrastructure evolves. Thanks, Ryan Code: ;;; flycheck-matlab-mlint.el --- Flycheck: MATLAB support -*- lexical-binding: t; -*- ;;; Commentary: ;; Provides support for MATLAB code checking with mlint and flycheck ;; that integrates with matlab-mode ;; ;; Usage: ;; ;; (eval-after-load 'flycheck ;; '(add-hook 'flycheck-mode-hook #'flycheck-matlab-mlint-setup)) ;;; Code: (require 'flycheck) (flycheck-define-checker matlab-mlint "A MATLAB checker using MATLAB mlint" :command ("mlint" "-id" "-all" source-original) ;; Example mlint messages. ;; L 588 (C 46-49): LOAD: To avoid conflicts with functions on the path, specify variables to load from file. ((warning line-start "L " line " (C " column "-" column "): " (id (* alnum)) ":" (message)) (warning line-start "L " line " (C " column "): " (id (* alnum)) ":" (message)) ) :modes (matlab-mode) :predicate (lambda () (flycheck-buffer-saved-p))) ;;;###autoload (defun flycheck-matlab-mlint-setup () "Set up Flycheck MATLAB mlint. Adds `matlab-mlint' to `flycheck-checkers'. NOTE: This disables showing warnings with the matlab-mode mlint integration" (interactive) (add-to-list 'flycheck-checkers 'matlab-mlint) (eval-after-load 'matlab '(setq matlab-show-mlint-warnings nil))) (provide 'flycheck-matlab-mlint) ;;; flycheck-matlab-mlint.el ends here
_______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss