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).
Asked
Active
Viewed 2,282 times
9

Eleno
- 1,428
- 11
- 17
-
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 02 '15 at 20:32
1 Answers
9
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.

Malabarba
- 22,878
- 6
- 78
- 163
-
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 08: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 09:03
-
1
-
@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 06 '16 at 17:45