9

The compilation-auto-jump-to-first-error option should make Emacs jump to the first error during compilation. However, it seems that Emacs treats warnings and errors in the same way, and jumps to the first one of either. How would you make Emacs jump to the first error if any, or to the first warning otherwise? I would rather fix errors first, and then warnings (especially because warnings could be caused by third-party libraries).

  • This sounds like a reasonable candidate for a bug/enhancement-request report: M-x report-emacs-bug. (Unless someone points out here that there is a trivial way to get the behavior you are looking for.) – Drew Jul 2 '15 at 20:32
5

As described on this blog post, you need a second option for that. compilation-skip-threshold

(setq compilation-skip-threshold 2)

Compilation motion commands skip less important messages. The value can be either
2 -- skip anything less than error,
1 -- skip anything less than warning or
0 -- don't skip any messages.
Note that all messages not positively identified as warning or info, are considered errors.

  • Is there a way to have compilation stop on errors only and still be able to navigate between warnings? compilation-skip-threshold seems to apply to all navigation commands. – timor Sep 15 '15 at 8:22
  • @timor Not that I'm aware. You might be able to switch to the compilation and TAB through the warnings. – Malabarba Sep 15 '15 at 9:03
  • 1
    that is exactly the thing that does not work anymore :) – timor Sep 15 '15 at 9:56
  • @timor, you can do that by adding a compilation-finish-functions function and hooking compilation-start-hook and use (compilation-set-skip-threshold arg) as appropriate. – ergosys Jul 6 '16 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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