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 Answer
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.– timorCommented 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. Commented Sep 15, 2015 at 9: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.– ergosysCommented Jul 6, 2016 at 17:45
M-x report-emacs-bug
. (Unless someone points out here that there is a trivial way to get the behavior you are looking for.)