Tuesday, May 27, 2014

Emacspeak And Company: Complete Anything Front-End For emacspeak

Emacspeak And Company: Complete Anything Front-End For Emacspeak

1 Emacspeak And Company: Complete Anything Front-End For Emacspeak

Module emacspeak-company speech-enables package Company — a flexible complete-anything extension for Emacs. Package company gains much of its flexibility by providing an extensible framework for both back-ends and front-ends; back-ends are responsible for language-specific support e.g., C++ vs Emacs Lisp; front-ends can provide different visualizations of the available completions.

I started using package company as I taught myself to program in Go over the last couple of weeks, and package emacspeak-company was one of the bi-products.

1.1 Using Company With Emacspeak

You can turn on company-mode in dividual buffers; you can also turn it on globally. Company comes pre-packaged with backend support for many programming languages; for programming in Go, I use module company-go in conjunction with the GoCode tool.

See customization group company to customize package company; Emacspeak loads package emacspeak-company when package company is loaded, and that automatically sets up the Emacspeak front-end.

Once activated, package company shows available completions where available once you type a prescribed number of characters. Available candidates are displayed visually via an overlay and can be traversed using either the up/down arrows or keys M-n and M-p. You can also search and filter the available completions, see documentation for command company-mode. The available visual front-ends also display relevant metadata for the current candidate in the echo area.

Front-end emacspeak-company performs the following additional actions:

  • Speaks current candidate along with the relevant metadata.
  • The metadata is spoken using voice-annotate.
  • Auditory icon help indicates that completion has started.
  • pressing F1 during completion displays documentation for the current candidate.
  • You can choose the current candidate by pressing RET; this

speaks the selected candidate.

  • Auditory icon close-object indicates that completion has finished.

1.2 Insights From Speech-Enabling Company

Company uses a fluid visual interface to display completions without the user having to switch contexts — it achieves this by using overlays that appear briefly in the form of a conceptual tooltip. These pseudo tooltips are created and destroyed via a timer; keyboard interaction causes these to be updated — including hiding the tooltip where appropriate.

Module emacspeak-company speech-enables this interface by examining the underlying information used to create the visualization to produce an effective audio-formatted representation. The net effect is that you can write code with completion helping you along the way; you do not need to switch tasks to lookup details as to what completions are available.

1.3 Acknowledgements

Thanks again to the authors of package company for a really nice tool — it's a real productivity winner — especially when learning a new language and its built-in packages.

I found these articles really helpful while learning to write package emacspeak-company.

Learning Go was a pleasure (it's still a pleasure — I'm still learning:-)) and the documentation on GoLang is excellent. As an added bonus, that entire site uses clean, well-formed HTML without any unnecessary artifacts that make so much of today's Web a giant mess; I have been able to use Emacs/EWW exclusively while working with golang.org — a real bonus for someone programming heavily in Emacs.

Date: <2014-05-27 Tue>

Author: T.V Raman

Created: 2014-05-27 Tue 08:51

Emacs (Org mode 8.2.6)