10

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).

1
  • 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
    Commented Jul 2, 2015 at 20:32

1 Answer 1

10

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.

4
  • 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
    Commented Sep 15, 2015 at 8:22
  • @timor Not that I'm aware. You might be able to switch to the compilation and TAB through the warnings.
    – Malabarba
    Commented Sep 15, 2015 at 9:03
  • 1
    that is exactly the thing that does not work anymore :)
    – timor
    Commented Sep 15, 2015 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
    Commented Jul 6, 2016 at 17:45

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.