Closed ajvargo closed 6 years ago
Thanks. Have you tried doing what @ignacy requested using this hook?
I didn't do exactly what @ignacy asked for, but I did exercise it with my own setup by using it to put a failure count in the mode line.
(defvar ajv-rspec-cached-fail-count nil)
;; Not sure I need this one. Definitely need the one below for ajv-rspec-mode-line
(put 'ajv-rspec-cached-fail-count 'risky-local-variable t)
(defvar ajv-rspec-mode-line
'(:eval
(cond ((null ajv-rspec-cached-fail-count)
(propertize " RSpec Failures: ?" 'face 'font-lock-comment-face))
((> ajv-rspec-cached-fail-count 0)
(propertize (concat " RSpec Failures: " (int-to-string ajv-rspec-cached-fail-count)) 'face 'font-lock-warning-face))
(t (propertize " RSpec Failures: -" 'face 'font-lock-constant-face))))
"Mode line format for RSpec error count.")
(put 'ajv-rspec-mode-line 'risky-local-variable t)
(defun ajv-rspec-update-cached-fail-count ()
(setq ajv-rspec-cached-fail-count (length rspec-last-failed-specs)))
(add-to-list 'mode-line-misc-info 'ajv-rspec-mode-line 'APPEND)
(add-hook 'rspec-after-verification-hook 'ajv-rspec-update-cached-fail-count)
I'll probably be following this up w/ a PR for before-verification. It'd be nice to clear the value when verification starts. (Or, if you are down w/ it, I can add it to this one.)
Or, if you are down w/ it, I can add it to this one.
Sure.
Added the before
hook. Corrected docstring indentation. We'll see if I got it right this time. Oi.
It seems that the development of this feature has stopped. I want to use this feature. May I take over the development of this feature and make a new PR from my fork?
@kzkn Please do. I kept meaning to answer about the last arg being nil and never did. :(
thanks. I'm gonna do it! :)
Closing in favor of #171
This hook will be run as the last
compilation-finish-function
at the end of having runrspec-verify
or its variants.This should handle the use case for #130. It follows the advice of those comments making the generic hook.