reddit / emacs

Flymake doesn't work as expected

EmilySeville7cfg · 2022-05-19 07:45
Emacs version: 26.3 Hello! I want use [yamllint][plugin] to see any errors in YAML files. When I install it and edit `~/.emacs` as follows: ``` (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (add-hook 'yaml-mode-hook 'flymake-yamllint-setup) (flymake-mode) (package-initialize) (when (version<= "26.0.50" emacs-version) (global-display-line-numbers-mode)) (setq completion-styles '(basic partial-completion emacs22 substring)) ;; Interface customization (set-face-foreground 'default "#660066") ``` and open my test .yml file I obtain nothing except this error: ``` Warning (flymake): Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function) ``` How to fix it? I don't understand why it happens. Also when I tried to setup keybindings for switching between several errors: ``` (define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error) (define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error) ``` I obtained another error: ``` Warning (initialization): An error occurred while loading ‘/home/emilyseville7cfg/.emacs’: Symbol's value as variable is void: flymake-mode-map To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the ‘--debug-init’ option to view a complete error backtrace. ``` It's strange because [documentation][docs] provides exactly these Lisp expressions. What am I missing? [See my issue for more details on GitHub][issue] [plugin]: https://github.com/shaohme/flymake-yamllint [docs]: https://www.gnu.org/software/emacs/manual/html_mono/flymake.html#Finding-diagnostics [issue]: https://github.com/shaohme/flymake-yamllint/issues/3
EmilySeville7cfg · 2022-05-19 12:03
How to fix this problem: - install `yaml-mode` - change config to this one: ``` (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) (require 'flymake-yamllint) (add-hook 'yaml-mode-hook #'flymake-yamllint-setup) (add-hook 'yaml-mode-hook #'flymake-mode) (remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake) (when (version<= "26.0.50" emacs-version) (global-display-line-numbers-mode)) (setq completion-styles '(basic partial-completion emacs22 substring)) ;; Interface customization (set-face-foreground 'default "#660066") ```