MidLifeXis has asked for the wisdom of the Perl Monks concerning the following question:

I am starting to put together some code for an emacs module that peers into Devel::Cover reports along the same lines as rcov-overlay.el, but also linking in linum-mode.el instead of highlighting the code lines themselves. I will need to port rcov-overlay.el, and also add a Devel::Cover formatting module to output the JSON used by the rcov-overlay module. There is a compilation output report that generates output that an emacs compile buffer can use, but I would like to display it in the code buffer itself.

I am searching for other prior art. If something like this already exists that I can just link into my toolset, great. If not, it is a small project to fill in my "spare time", and perhaps a positive contribution to the community. Does anyone know of any other prior art that has previously implemented this on the target platform (emacs + Perl)?

Why? I have been a user of emacs since the early '90s, but I have not made use of the vast range of tools available to assist my coding efforts. I have recently started using ECB, unit-test.el (along with some custom save-file hooks), and a couple of other pieces of emacs glue (yet to be published), that have really allowed me to step up my game. I am also evaluating PDE, but have not had great results with it, as it seems to be very focused on the author's own development environment and process (not that this is bad, it just didn't fit into my toolchain).

There are also the Devel::Cover::Report::Compilation module, allowing emacs to provide a compile buffer given appropriate file/line pairs to allow jumping to the offending line, and the Devel::Cover::Report::Vim module, allowing this type of glue within Vim.

References:

And yes, I am attending the Tweakers Anonymous talk at YAPC::NA 2012.

Update: Added actual question, since the question was only implied.

Update: Added json.el link, omitted from original list of emacs modules (thanks pvaldes).

Update: Added links to other report types that are currently within Devel::Cover.

--MidLifeXis

Replies are listed 'Best First'.
Re: Coverage tool visibility within emacs
by pvaldes (Chaplain) on May 26, 2012 at 00:17 UTC
    I am starting to put together some code for an emacs module that peers into Devel::Cover reports along the same lines as rcov-overlay.el, but also linking in linum-mode.el instead of highlighting the code lines themselves. I will need to port rcov-overlay.el, and also add a Devel::Cover formatting module to output the JSON used by the rcov-overlay module.

    Sounds interesting but I didn't understand a word... Please, could you explain your goal in simple words avoiding to link to a lot of obscure lisp references?

      Emacs is a lisp interpreter disguised as an editor. The obscure lisp references are modules for that editor (think CPAN for Emacs). The rcov-overlay module calls ruby's coverage tool, brings the results back to emacs as a JSON data set, and highlights the resulting lines in the code that are covered or not. Linum is a module that shows line numbers in an emacs buffer, but allows you to customize what those line numbers look like.

      My goals are:

      • First, get the rcov-overlay port in place, but calling Devel::Cover tools instead. This would include returning the data in JSON format from Devel::Cover (currently does not exist). This would be (I think, I have only read the source) similar to Devel::Cover::Report::Vim. This would be in two parts - the rcov emacs component and the Perl module to generate the data.
      • Second, make use of the customization features of the linum module to be able to indicate (say with differently colored pipe symbols) what type of coverage is failed for a given line number.

      The first is to get the JSON reporting module in place, the second is to be able to get it identifying what is actually being reported. As an alternative for the second point, perhaps tooltips (hovertext, IntelliSense, whatever your editor's term of choice happens to be) might be the path to take. Not sure yet. Perhaps both will be selectable.

      Hope that clarifies it a bit.

      --MidLifeXis

Re: Coverage tool visibility within emacs
by pvaldes (Chaplain) on May 29, 2012 at 15:42 UTC

    mmh, much more clear now, yes. So you need to deal with a perl part and a lisp part

    joining some dots that could (or not) to be useful for you

    If you want to pick-up error messages from json, maybe you could wish to explore the functions available in the json package. i.e json-error

    (require 'json) ;; create data lisp structures from json files
    or, in emacs...
    m-x load-library json apropos json