8

The common use of Vim's quickfix is to hand off compilation of code to a command specified by the suggestively named makeprg variable and then interpret the errors printed by that command so you can quickly jump to the file, row, and column location of each error.

Vim's quickfix can be subverted and used in other ways but my question only concerns how to reproduce the above described behavior.

What Emacs feature is nearest to Vim's quickfix?

1
  • For people looking for cycling through quickfix results like with vimgrep or Neovim's telescope.nvim - especially with Doom Emacs - see emacs.stackexchange.com/questions/35554/…
    – user37362
    Apr 1, 2022 at 22:34

1 Answer 1

16

Compilation Mode does the same thing and is built-in. Here is a demo. Basic usage:

  • M-x compile to run the compilation command (like :make)
  • The command is taken from the variable compile-command (like the makeprg option)
  • M-g p and M-g n to go to the location of the previous/next error (like :cp and :cn)
  • M-{ and M-} to go to the previous/next file with an error (like :cnf and :cpf)

You also have flycheck for on-the-fly syntax checking, support 43 languages with 73 syntax checkers. Here is a flycheck demo (from the Github page). As you see, when the erroneous code is fixed, the error list refreshes automatically. And of course, you can click or press RET on the errors in the list to jump to the erroneous location.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.