Revising nndiscourse.el

Enhancing nndiscourse: New Features and Improvements

Introduction

I’ve been working on enhancing the nndiscourse package for Emacs, which provides a Gnus backend for Discourse forums. I wanted to share some of the recent improvements that make it more powerful and user-friendly.

Key Enhancements

1. Username Display Fix

Previously, usernames were showing as “unknown” in posts. I’ve implemented a fix that:

  • Properly extracts usernames from Discourse API responses
  • Caches usernames to reduce API calls
  • Shows the actual username of the person who posted each topic

2. JSON Parsing Performance

To address performance issues with JSON parsing:

  • Built a custom Emacs from the faster-json-parsing branch
  • Added JSON timing logging to measure and compare performance
  • Significantly reduced parsing time for large forum responses

3. Posting Capabilities

The biggest enhancement is adding posting capabilities to transform nndiscourse from a read-only client into a fully interactive Discourse client:

  • Create new topics in any category
  • Reply to existing posts with proper threading
  • Use Markdown formatting in your posts
  • Secure authentication using Discourse credentials or API key

Usage

This topic was created in emacs, but when pressing C-c C-c' it currently opens your browser with the topic details populated. I am working on being able to post directly from emacs, I am, I promise.

Creating a new topic will be as simple as pressing C-c C-n in the Gnus Summary buffer, while replying to a post will be done with C-c C-r in the Article buffer. Keybindings are subject to change.

Future Plans

I’m considering adding support for:

  • File attachments
  • Further performance optimizations
  • Improved error handling

Conclusion

These improvements make nndiscourse a much more complete solution for interacting with Discourse forums directly from Emacs. I hope to have some code available soon(ish)

Happy Emacs-ing!

This is what it looks like in gnus

2 Likes