# Progress Update: Emacs Discourse Integration

**URL:** <https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253>\
**Category:** General\
**Created:** [January 3, 2025, 9:27am UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253 "2025-01-03T09:27:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glenneth](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/glenneth/32/11_2.png) [@Glenneth](https://forum.systemcrafters.net/u/Glenneth)\
**Post date:** [January 3, 2025, 9:27am UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/1 "2025-01-03T09:27:28Z")

</div>

Features Implemented  
✅ Category listing and navigation  
✅ Topic viewing with proper formatting  
✅ Reply functionality with markdown support  
✅ Proper CSRF token handling for API requests  
✅ Clean buffer management and UI  
Current Focus  
Working on improving the user experience with:

Better error handling  
Intuitive keybindings  
Markdown preview support  
Topic creation interface  
Next Steps  
Add topic creation functionality  
Implement search capabilities  
Add user profile viewing  
Support for private messages  
Feel free to test it out and provide feedback! The code is available at: [glenneth/discourse-emacs: A modern Emacs package for seamless Discourse forum integration. - Codeberg.org](https://codeberg.org/glenneth/discourse-emacs) this post was made using the [glenneth/discourse-emacs: A modern Emacs package for seamless Discourse forum integration. - Codeberg.org](https://codeberg.org/glenneth/discourse-emacs) branch

---

<div class="post-metadata">

**Author:** ![ashraz](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ashraz/32/509_2.png) [@ashraz](https://forum.systemcrafters.net/u/ashraz)\
**Post date:** [January 3, 2025, 12:41pm UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/2 "2025-01-03T12:41:06Z")

</div>

@Glenneth are all those posts supposed to be four different topics? That seems… Kinda spammy, tbh.

---

<div class="post-metadata">

**Author:** ![Glenneth](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/glenneth/32/11_2.png) [@Glenneth](https://forum.systemcrafters.net/u/Glenneth)\
**Post date:** [January 3, 2025, 12:43pm UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/3 "2025-01-03T12:43:47Z")

</div>

They were separate posts. And yes it was a bit spammy. David has since set me up with a testing area. I was testing new features in my discourse package for creating new topics this morning.

I apologise for the spamming @ashraz

---

<div class="post-metadata">

**Author:** ![ashraz](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ashraz/32/509_2.png) [@ashraz](https://forum.systemcrafters.net/u/ashraz)\
**Post date:** [January 3, 2025, 12:56pm UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/4 "2025-01-03T12:56:01Z")

</div>

> [@Glenneth](#):
>
> Feel free to test it out and provide feedback! The code is available at: [glenneth/discourse-emacs: A modern Emacs package for seamless Discourse forum integration. - Codeberg.org](https://codeberg.org/glenneth/discourse-emacs) this

> ```lisp
> ;; Global keymap
> (define-key global-map (kbd "C-c d") discourse-command-map)
> 
> ```

That violates the key bindings convention for packages. `C-c <letter>` is reserved for users, see `(elisp) Key Binding Convention`:

> ## D.2 Key Binding Conventions
> 
> ===========================
> 
> - Don’t define `C-c LETTER` as a key in Lisp programs. Sequences consisting of `C-c` and a letter (either upper or lower case; ASCII or non-ASCII) are reserved for users; they are the _only_ sequences reserved for users, so do not block them.

---

<div class="post-metadata">

**Author:** ![Glenneth](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/glenneth/32/11_2.png) [@Glenneth](https://forum.systemcrafters.net/u/Glenneth)\
**Post date:** [January 3, 2025, 12:58pm UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/5 "2025-01-03T12:58:08Z")

</div>

Thanks @ashraz. That should be an easy fix. Maybe 🤣

---

<div class="post-metadata">

**Author:** ![ashraz](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ashraz/32/509_2.png) [@ashraz](https://forum.systemcrafters.net/u/ashraz)\
**Post date:** [January 3, 2025, 1:01pm UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/6 "2025-01-03T13:01:59Z")

</div>

> [@Glenneth](#):
>
> I apologise for the spamming @ashraz

No worries. I’d just recommend to test your package with a local installation of Discourse. That allows you to also check multi-user experience (e.g. have user `Glenneth` active in Emacs instance 1 and `Troll` in Emacs instance 2) without having to ask other users for private messages and/or replies 🙂

---

<div class="post-metadata">

**Author:** ![Glenneth](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/glenneth/32/11_2.png) [@Glenneth](https://forum.systemcrafters.net/u/Glenneth)\
**Post date:** [January 3, 2025, 1:03pm UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/7 "2025-01-03T13:03:59Z")

</div>

That could be a preferable testing environment for sure. I never thought of installing discourse locally for that.

---

<div class="post-metadata">

**Author:** ![ashraz](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ashraz/32/509_2.png) [@ashraz](https://forum.systemcrafters.net/u/ashraz)\
**Post date:** [January 3, 2025, 1:05pm UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/8 "2025-01-03T13:05:17Z")

</div>

Another easy fix: remove the duplicate functions. `discourse--create-topic` is defined twice, once in L870, once in L1183.

It’s also a bit weird to see `discourse-api-request` intermixed with plain `request`. That will make refactoring (or replacing `request` with `url-retrieve`) harder later on.

(I’d comment on Codeberg, but I don’t have an account there, sorry)

---

<div class="post-metadata">

**Author:** ![Glenneth](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/glenneth/32/11_2.png) [@Glenneth](https://forum.systemcrafters.net/u/Glenneth)\
**Post date:** [January 4, 2025, 3:06am UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/9 "2025-01-04T03:06:36Z")

</div>

@ashraz i’ve changed the discourse command map keybindings in a feature branch for now and also removed the duplicate create-topic function. New keybindings look like this

```elirp
;; Global keymap
(defvar discourse-command-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "l") 'discourse-login)
    (define-key map (kbd "g") 'discourse-get-categories)
    (define-key map (kbd "t") 'discourse-get-topic)
    (define-key map (kbd "c") 'discourse-create-topic)
    (define-key map (kbd "v") 'discourse-view-topic)
    (define-key map (kbd "r") 'discourse-reply-to-post)
    map)
  "Keymap for Discourse commands.")

(define-key global-map (kbd "C-c C-d") discourse-command-map)

```

---

<div class="post-metadata">

**Author:** ![ashraz](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ashraz/32/509_2.png) [@ashraz](https://forum.systemcrafters.net/u/ashraz)\
**Post date:** [January 4, 2025, 9:16am UTC](https://forum.systemcrafters.net/t/progress-update-emacs-discourse-integration/1253/10 "2025-01-04T09:16:09Z")

</div>

That’s a great addition. _ **But** _: that’s also reserved:

> ### [D.2 Key Binding Conventions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html)
> 
> - …
> - Sequences consisting of `C-c` followed by a control character or a  
> digit are reserved for major modes.

I’d recommend you to read [`(elisp) Key Binding Conventions`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html) and also go the “usual” way, e.g. instruct your users to set up their own bindings. Both [Org mode](https://orgmode.org/orgguide.html#Activation-1) and [Prot’s denote](https://protesilaos.com/emacs/denote#h:5d16932d-4f7b-493d-8e6a-e5c396b15fd6) do so in their sample configuration.

Also, that almost looks like you want to have a transient menu. So you might consider using `transient` and a `discourse-menu` there instead of a keymap. Speaking of `menu`, you might also want to tackle an Discourse menu (for `menu-bar-mode`).
