I use Emacs with Cucumber (cucumber.io). Cucumber outputs lines like this:
Scenario: Jeff returns a faulty microwave # /somepath/file1.feature:12
Given Jeff has bought a microwave for $100 # /somepath/steps/file2.rb:5
And he has a receipt
When he returns the microwave
Then Jeff should be refunded $100
Exception blah
/path/someotherdir/sourcefile.rb:123:error xxx occured
Scenario: Some other scenario... # /somepath/file1.feature:23
Given ...
Everything works splendidly with the compilation buffers. I have made some entries in compilation-error-regexp-alist
that locate those comments as "info" (in addition to whatever compiler/runtime errors from the Ruby environment) and am able to jump through everything.
Now, my question:
I would find it very handy if I could not only step between the "next" (M-n
) and "previous" (M-p
) steps in a completely linear fashion, but if I could separately do a "next scenario" (C-M-n
) and "previous scenario" (C-M-p
) binding. Those would ignore everything and just jump between the lines starting with Scenario:
.
Is such a thing possible?
previous-error
in Emacs 25.1. What's your version? In any case,next-error
takes an optionalARG
. IfARG
is negative, it moves backwards. Soprevious-error
would be(next-error -1)
. – Tianxiang Xiong Mar 29 '17 at 22:24M-g M-n
andM-g M-p
are bound tonext-error
andprevious-error
, respectively. – npostavs Mar 29 '17 at 22:41previous-error
on 24.3 also (edited), only no built-in keyboard shortcut. Glad they appear on Emacs 25. – Ehvince Mar 30 '17 at 08:33(defun my-previous-scenario () (interactive) "Jump to the previous cucumber scenario in the compilation buffer" (switch-to-buffer-other-window "*compilation*") (search-backward "Szenario:") (execute-kbd-macro (kbd "<return>")))
(similar for the "next" function) - feel free to edit it into your answer. – AnoE Mar 30 '17 at 09:06