Tuesday, December 19, 2023

Emacspeak: Hidden Holiday Gems

Emacspeak HHG: Hidden Holiday Gems

1. Introduction

This is an Emacspeak-specific follow-on to my article Emacs: Hidden Holiday Gems. This article extends its predecessor by:

  1. Adding Emacspeak-specific details for each gem; the earlier article purposely avoided anything Emacspeak-specific.
  2. Where appropriate, I'll point out the importance of choosing a solution that is appropriate to the user, e.g., low-vision vs complete eyes-free use. Note that for the most part, Emacspeak is optimized for the latter case.
  3. As before, the goal is not to be exhaustive; — rather the goal is to be thought-provoking with respect to encouraging readers to discover their own optimal solution. The reference section at the end links to some of the follow-up discussion on the Emacspeak Mailing List.
  4. All topics covered here are already well-documented in the Emacs and Emacspeak manuals, and this article will not attempt to replace those.

2. Emacspeak: Hidden Holiday Gems

Selective Display
This expands and collapses content purely based on indentation. The human eye is very efficient at scanning down the margin and ignore content indented beyond a given level; selective-display provides the same affordance when you cannot see the display.
Registers
Easily becomes part of muscle-memory, especially when moving text around, duplicating content in multiple locations. For more complex use-cases, I use yasnippets, which is one of Emacs' many template libraries.
Bookmarks
Emacspeak builds heavily on Emacs' built-in bookmarks to provide:
  1. Persistent bookmarks when reading EPub and Bookshare books.
  2. Audio Marks (AMarks) within org-mode buffers for marking locations in audio streams such as Podcasts.
  3. An Emacspeak browser for browsing saved eww-marks and a-marks.
  4. Together, the above make a very useful note-taking extension to org-mode.
Tabulated Lists

Implements tabulated UIs and is speech-enabled by Emacspeak.

  • Emacspeak augments it with additional keyboard navigation.
  • This is leveraged in Emacs by a variety of

end-user packages including package.el and its asynchronous cousin paradox.el.

  • It is also used to advantage by empv, a powerful

interface to the GNU MPv media player.

  • AMarks mentioned in the previous item, this is my present means of listening to tech-talks on Youtube while taking notes using org-mode.
Forms Mode
Forms interface used by Emacspeak to browse BBC programs.
Mark Ring
Supported by default in Emacspeak but something I dont use much. Some of its affordances really shine in transient-mark-mode but that facility is somewhat counter to eyes-free use.
Undo
Both basic and advanced. However a long series of undo and redo commands as with tree-undo can get confusing quickly in eyes-free interaction.
Dired
I use dired-mode and its derivatives heavily:
  • To browse the file-system as intended.
  • With emacspeak-zoxide to rapidly move to far-away portions of the file system.
  • With locate to search the file system.
  • With command emacspeak-m-player-locate-media to find and play local media.
  • With flx and fuzzy completion to provide a powerful interactive UI for finding and playing media such as Internet streams.
- Writeable Dired
Useful to:
  • Consistently rename files, especially when confronted with filenames with embedded white space.
Org-Mode
This margin is too small to do it justice; see documentation for module emacspeak-org for all that Emacspeak does with org.
Magit
As with the previous item, see the associated Emacspeak documentation for emacspeak-magit.
Forge
I use forge for issue tracking, but often revert to old habits and use gh at the shell inside Emacs.
EWW
See the Emacspeak documentation for emacspeak-eww. Highlights include:
  • Dom filtering,
  • XPath filtering,
  • MPlayer and EMpv integration for playing online media,
  • EPub and Bookshare books,
  • And much, much more.
Elfeed
My chosen means of following RSS and Atom feeds.
GNUS
For mail, now that Usenet is history.
  • I use gnus as an imap mail reader for GMail.
  • Emacspeak implements the equivalent of GMail's search operators.
  • I complement gnus with package vm for reading email delivered locally; I use fetchmail to fetch mail and procmail to sort mail into folders in the background.
  • And finally I use notmuch to search locally saved email.
Tramp
Accessing and working in the Cloud:
  • I use tramp to open remote files.
  • Emacspeak wizard emacspeak-wizards-tramp-open-location to quickly open files on servers I access often.
  • If you work in the Cloud, Emacspeak lets you SSH to your CloudTop and have Emacs running on the CloudTop speak on your local machine.
  • The above can be done using a plain old XTerm with screen, dtach, or emacs –daemon providing a persistent Emacs session at the remote end.
  • Alternatively, you can use wizard emacspeak-wizards-remote-frame to open a graphical frame on the remote machine.
Eshell
A Shell that is deeply integrated into Emacs. Fully speech-enabled by Emacspeak. Well-suited for running compile, grep and friends for starters.
Comint
This is the goto solution for software development in Emacspeak, be it Common Lisp or Python.
Zip Archives
One more reason you dont need to leave Emacs for a text console.
Calculators
From the simple to complex, we have it all!
  • Simple calculations.
  • Symbolic Algebra.
  • Calc in embedded mode can directly replace a calculation with an answer.
  • For even smarter work-flows, leverage org-mode with calc.
  • you can even audio-format computations in Calc output as LaTeX using AsTeR.

3. References

  1. Mailing List Discussion.
  2. Emacs: Hidden Holiday Gems.
  3. Emacspeak Manual.
  4. Emacspeak Blog Articles as a single page.

    Note that the Emacspeak blog, the online manual etc., are all available locally in the Emacspeak Git checkout.

Friday, December 15, 2023

Emacs: Hidden Holiday Gems

Emacs HHG: Hidden Holiday Gems

1. Overview

The acronym HHG evokes Douglas Adams' Hitch Hikers Guide To The Galaxy in the minds of most geeks. This article takes a quick semi-guided tour through some of the gems that are hidden in plain sight within Emacs. This article was prompted by some recent discussions on the emacs-devel@gnu.org list which revealed the somewhat obvious — not everyone uses all available features in Emacs — if that were even possible.

So without further ado, here is a brie list of hidden gems in Emacs as a teaser — I use many of these on a regular basis, but as you'll see there are gems that I know of that I haven't managed to integrate into my workflow, leave alone those gems that I am not even aware of.

2. Emacs: Hidden Holiday Gems

Selective Display
Collapse/Expand content based on indentation. Useful in browsing code, as well as structured output from various shell commands.
Registers
Quickly save text fragments, buffer locations and window configurations and restore them easily. I use registers for saving text fragments, but have never used it as a means to navigate.
Bookmarks
Persist various types of locations. Note that registers can be persisted across Emacs sessions as well.
Tabulated Lists
Build up tabulated UIs that behave consistently.
Forms Mode
Leverage underlying syntax e.g., field-delimiters, to enable structured editing via a forms-like interface.
Mark Ring
Local and Global mark rings. This is one I've been aware of for over 30 years but never managed to work into my work-flow.
Undo
Both basic and advanced. I myself only use the most basic form of undo.
Dired
Surprisingly not everyone appears to use dired, or at least as heavily as I expected.
Writeable Dired
This became part of Emacs more than a decade ago — but often remains undiscovered and under-exploited. Ignorance leads to more complex and error-prone shell hacks.
Org-Mode
Org is often cited as one of the most powerful Emacs add-ons that makes Emacs attractive to engineers and authors alike. But the breadth and scope of this package means that not all of us use all of it. As an example, I use org-mode for all my writing, but have never used it for todo-list or agenda management.
Magit
Another magical gem that I use heavily — but there are more parts of Magit that I dont use than I use — not due to any shortcoming in Magit, but more because of the nature of my typical work-flow vs the myriad work-flows that Git provides and that Magit makes accessible to the mere mortal.
Forge
Interact with Git repositories — a powerful tool where I myself have only scratched the surface.
EWW
Hard to believe that shr and eww have now been part of Emacs for nearly a decade. Though not hidden, they still get ignored by most users because of the addiction to the JS-powered Web; EWW does not implement Javascript. But that shortcoming is a major win, both for efficiency and for preserving privacy — EWW remains one of the most effective means of focusing on the real content of Web pages.
Elfeed
With EWW for surfacing the content in noisy News pages, Elfeed provides the complementary functionality of browsing RSS and Atom Feeds — which together let you focus on content as opposed to endlessly mnavigating a Web site.
GNUS
Gnus remains one of the most powerful email tools, but its potential as an email-reader often gets overlooked.
Tramp
When I first discovered Emacs in Grad School, ange-ftp for opening files on a remote site was an incredible innovation. As the Web took over and FTP disappeared, the ability to open remote files from within Emacs receded into the background — but that functionality quietly turned into something more powerful, namely tramp. I myself mostly ignored Tramp until I discovered about 20 years ago that it was a neat way to edit files as Root on my laptop; but Tramp really came back into its own when I started working from home during the pandemic.
Eshell
A Shell that is deeply integrated into Emacs. I believe I would be more productive if I used Eshell all the time, but despite myself, I'm still using Bash in Emacs shell-mode!
Comint
A Command Interpreter to bind them all! This is a hidden gem that is a true work-horse when it comes to all Emacs functionality for interacting with command interpreters. It is a good example of a mature platform-level affordance, where Emacs is the platform.
Zip Archives
Emacs can open archive files like zip,

tar.gz and friends and provide an interactive dired-like interface. It also turns out to be a light-weight way of excavating XML content from MSFT word-processor files (DocX).

Calculators
Yes, there is more than 1;-) The built-in not-so-light-weight calculator and the even more powerful (and also bundled ) calc package. I still remember the time I was buying my first home 25+ years ago, and sitting with my real-estate agent while she educated me on mortgages. She was looking over my shoulder as I typed in Emacs; what to her looked like plain text, and what to me was my Scratch Buffer. After we had considered some options, I typed a few keys to invoke Calc in embedded-mode and a second later she was looking at that plain-text display showing the monthly installment for the mortgage we were discussing!

3. Conclusion

  1. There are clearly a lot more hidden gems than enumerated here; otherwise they wouldn't be Hidden.
  2. These work best when Emacs provides a cleanly defined platform that enables the creation of these extensions via Emacs Lisp.
  3. There is an interesting balance between letting a thousand flowers bloom vs refactoring to create common APIs based on developer needs. Org is an outstanding example of this, both with respect to enabling the discovery of such APIs, and an example of where a good set of platform-level APIs are rich for plucking; failure to do so means that at present, org-mode is turning into a platform in its own right atop the Emacs platform.

vHappy Holidays — And Share And Enjoy!