r/emacs • • 6d ago

Fortnightly Tips, Tricks, and Questions β€” 2026-11-17 / week 46

12 Upvotes

This is a thread for smaller, miscellaneous items that might not warrant a full post on their own.

The default sort is new to ensure that new items get attention.

If something gets upvoted and discussed a lot, consider following up with a post!

Search for previous "Tips, Tricks" Threads.

Fortnightly means once every two weeks. We will continue to monitor the mass of confusion resulting from dark corners of English.


r/emacs • • 8h ago

lzdockel: A lazydocker-inspired Docker UI built natively in Emacs

15 Upvotes

Hey everyone,

I usually use lazydocker in the terminal for checking for Docker stuff, but I'm kinda lazy to switch between emacs and terminal to check for that (and usinglazydocker on ghostel is not very native πŸ˜„)

So I built lzdockel https://github.com/tortoise10h/lzdockel which is Emacs-native Docker interface inspired by lazydocker

If you're interested, give it a try, and please let me know if you have any feedback


r/emacs • • 3h ago

Failed to verify signature archive-contents Error while using M-X pa-co

Post image
5 Upvotes

Hey guys,
So i was trying to install markdown-mode package and trying to refresh the package contents through M-X pa-co and everytime i do this it gives me error and i am not be able to proceed further , How to resolve this issue , I am on windows 10 i installed this emacs 31.1 version using installer.exe

Edit: It got fixed ! cuz my mysys2 gpg was creating this malformed directory while refreshing contents. so removing it solved the issue! Thanks


r/emacs • • 15h ago

Meow from evil

13 Upvotes

Hello! I am a new vanilla evil emacs user, and I have heard a lot about meow, and I came over to try it, but ran into a few issues:

  1. A lot of my keybinds on evil are <leader>-something, whereas I know meow encourages using god-mode to bind most of your keys to control or option. How do most ppl from evil to meow convert their leader keybinds?
  2. I cannot tell whether it is a quirk of meow or just years of muscle memory, but I feel that my editing style has become molded to vim, and if it was not for evil mode, I would not have even considered emacs. Even the caps lock key has turned into a escape on single and control in unison with other keys, and even instead of pressing h I press i <esc>. I could list many other ways my editing style is idiosyncratic, but I will spare you the boredom and get to the point, that as my brain has adapted to a lot of quirks in vim for example how ce and ci( finds the nearest quote, even the fact that a does not append after the visual cursor bugs me, and these little inconsistencies bother me.
  3. A big part of my keybindings is the lsp hover on K, and g-(d, rd, rr, rt, ri, rn, c, u, U, etc), and having an lsp action under C-c l seems very out of place for me...

I was wondering, especially for ppl who migrated from evil to meow, is the emacs-native worth it, and how do you handle these issues?


r/emacs • • 1d ago

Thank you emacs users and devs team!

73 Upvotes

So few days ago I shared a emacs post on reddit on how I started using emacs and why i cant use any other editor anymore, and it got almost 24k views and my blog which dont had any readers till that post , once the reddit post got released my blog got around 1.7k views from all over the world in 24 hrs.

The blog post got featured in emacs planetlife and sacha chua's november 16 round up post!

I was literally out of the sky that day! was so happy that people read my blog. Even though I write them for fun.

Emacs is an amazing community and I am glad to be the part of it!
Edit: If you dont know which blog here : https://kirisoft.pages.dev/#/blog/oNHZVj2yBY4JJBibEsD9

Thanks & Regards,
Kiri


r/emacs • • 19h ago

Protesilaos: Emacs: Denote version 4.3.0

Thumbnail protesilaos.com
15 Upvotes

r/emacs • • 1d ago

Vim/Neovim's hype dying while Emacs still lives on?

61 Upvotes

I noticed that with AI, the flames around Neovim is slowly fading away.

In 2025 the neovim community really had the spotlight everywhere I look. But now...

Emacs on the other hand is steadily moving forward at the same pace as before. Similar to the IDE and VSCode mania.

Vim is a realy good editor. It especially thrives at code editing. When AI stripped away the code editing part, what's left is almost nothing.

You can still edit prompts with it but it has to be streamlined somehow to other tools in order to be usable.

Emacs is not a code editor and that's why the AI flares didn't affect it that much. You still have your malleable tool that can adapt to everything.

What are your thoughts on this?


r/emacs • • 1d ago

Question Question to package authors: how do you deal with long names and scoping?

13 Upvotes

TLDR: I am struggling to best organize a bigger package specifically in elisp, due to everything being global/unscoped in elisp. Instead of e.g. Org8/AgentSession/Backend/ClaudeCodeVterm.hs with sessionTranscriptTailMesssagesCache function in it, I end up with org8-agent-session-backend-claude-code-vterm.el with defun org8-agent-session-backend-claude-code-vterm-session-transcript-tail-messages-cache. I have 20+y SWE experience and am not vibing it, I just love organizing code well.


Hey all, I am writing a somewhat bigger emacs package for some time now and I am starting to really struggle with long names of my functions/variables/files, and while I am quite sure at this point there is no great solution, I am hoping somebody might point me to a solution that works well enough in practice.

Btw my main languages are Haskell and TypeScript, so I might below accidentally use some terminology from there.

Ok so since in elisp everything is global, I prefix all symbols with <pkgname>-, ok that makes sense. In my personal config I was always using my/.

However, I have quite a few of files/modules in my package at this point, and I wanted to prefix functions in a way that makes it clear which module they come from. So i started doing <pkgname>-<module-name>- as prefix for symbols.

However, some modules are conceptually submodules of other modules, so that <module-name> in some instances is getting really big, because it is really <parent-module-name>-<child-module-name>, and that might even go to the third level.

And that sucks because of length, but I would say even length is not the biggest problem, the biggest problem is that once this whole big prefix is done, comes the name of the acual symbol, wihch is also likely multiple words, and there is no clear way to differentiate where the prefix starts and symbol beggins.

One of more extreme examples from my codebase, to show how ridiculous this gets:

org8-agent-session-backend-claude-code-vterm-session-transcript-tail-messages-cache

where org8-agent-session-backend-claude-code-vterm is prefix and -session-transcript-tail-messages-cache is what really carries the info on what symbol is in this context.

If this was some other language, I would have dir structure like Org8/AgentSession/Backend/ClaudeCodeVterm.hs and in it function sessionTranscriptTailMesssagesCache.

I guess I am addressing multiple problems here:

  1. Names are too long.
  2. There is no clear delineatinon between parts of the name.

I considered using some kind of abbreviations for names, like org8-as-b-ccvterm, but that is so hard to guess what it means.

I considered organizing it all somehow into directories but from what I understood so far that is not really how it is done for packages because it complicates distributing them, instead all is kept on top level.

I considered dropping part of prefix, just doing org8-claude-code-vterm, but I really don't like that when I konw where it belongs and this obscures, when looking at it in e.g. dired, where it fits into the whole codebase.

I am currently playing with shorthands, using this/ and this// to shorten prefix for public and private symbols, but that works only inside that file, make it much harder to search for a symbol accross files, and also doesn't solve long names for symbols I imported. Also, public symbols still look ridiculously long to users of the package.

Above is mostly about shortening the names. As for delineating prefix from actual name, I considered using /, like org8/agent-session/backend/claude-code-vterm/session-transcript-tail-messages-cache, but that is not a convention and I am worried it will look real weird for users when using the package public functoins, nobody does that from what I saw.


Thanks for any advice, I feel like while in theory these are just shortcomings of elisp, there must be some practically blessed way that works well for people so would love to hear what works, and that might also help me accept it.

EDIT: Seems that some commenters wonder if I am just overengineering or vibing this and it's a ton of slop code, so just want to clarify upfront that I am not, this is a bigger package at this point, been working on it for months, and it is somewhat complex, multiple subsystems, backends, implementations of those backends. I stick to my own versoin of Clean Code so I keep functoins small, I keep modules organized by responsibility, I use descriptive names, and so on. I have been programming like this for 20 or so years and enjoyed it so far, just have never done it in a language like elisp that has no scoping. And I am not complainng about elisp, I get that it is older and has its quirks, but am looking for practical advice how to get the most out of it.


r/emacs • • 1d ago

Machine Learning & AI Superchat 2.0: an Emacs agent that runs in your Emacs, keeps a record of its work, and learns skills from what worked

13 Upvotes

Superchat 2.0 is out. It is a rewrite of Superchat: an AI agent whose loop runs inside your Emacs process.

What makes it different from calling Claude Code/Codex through emacsclient, or from gptel:

  • It works in your Emacs. The model runs Lisp in your session (eval_elisp), reads and edits buffers, and looks up any installed package with a describe tool built on Emacs's own documentation, instead of guessing function names. Ask it to pull today's Telega messages on a topic, list the Org headings due this week, or fix the failing test in the buffer you have open.
  • It keeps a record. Every conversation, tool call and result goes into one append-only SQLite file (the Tape). It can search earlier work, keep notes, and each answer names the tool calls it relied on.
  • It learns from what worked. /learn calendar- turns the code that answers actually cited into a skill with typed tools; the next time it's one tool call instead of a search. Nothing is saved without your C-c C-c.
  • It keeps working. Timers, an inbox and background runs (while Emacs is open); a run that needs permission waits for you instead of blocking Emacs.

Permissions: read-only, ask (default: asks before every edit, write and command) or auto.

On Aider's polyglot benchmark (225 exercises, same model, deepseek-flash) it scored 85.8% against Aider's 80.0%: one run, details in the README.

Limits, honestly:

  • Models: OpenAI-compatible APIs (DeepSeek, Groq, local Ollama/LM Studio, …) and Anthropic's Messages API. The Anthropic part is tested against a stubbed server only.
  • No MCP and no sub-agents (1.x had both).
  • Emacs 30.1+ with SQLite.

Coming from 1.x: it is a rewrite (~6,500 lines plus a built-in model client, down from ~125k), with new settings; docs/migrating.md maps the old options and commands.

Repo: https://github.com/yibie/superchat

Release notes: https://github.com/yibie/superchat/releases/tag/v2.0.0

Feedback and bug reports welcome.


r/emacs • • 1d ago

Configuring speedbar to run in window-mode

Thumbnail github.com
29 Upvotes

I decided to write up how to get speed bar working in windows-mode with v31 given some parts of the process are non-trivial. This is the built in tree oriented file/buffer/specialized mode manager that ships with Emacs. Long term I think it has promise to be used more widely.


r/emacs • • 1d ago

Scaling up Org Agenda in 2026. How large are your agenda files?

11 Upvotes

Good day all,

  • I have been an org-agenda user since 2020.
  • A 1.9 MB org agenda file, ~4700 headings.
  • Heavy use of org custom agenda.

How do more experienced org-agenda users deal with the following:

  1. A slow org-agenda with a substantial agenda. org-agenda-list works one day at a time.
  2. Detection of double-booking. I am aware of org-conflict and I have my own fork with patches. E.g. a post-capture hook is not enough, as one reschedules existing items often enough.
  3. Detection of semantically similar tasks as an Org after-capture hook. E.g. it has happened that upon a reminder email for our turkey bowl game, I found myself adding the same gameday/practice reminders twice. I am aware of org-semantic, but have a custom, lighter sqlite-vec solution that adds a :SIMILAR: property drawer like :RESOURCE:.

I am curious to hear your workflow on all 3 points.

I have pointed my favourite stochastic parrot at point 1 specifically, and the implementation for a pre-filter index is here, but I wish to discuss higher-level details. I believe it's no outlier to need to see 2 months ahead; I have noticed that if I increase the look-ahead on the agenda from something from 60 to 120 days I get the following performance increases after a pre-filter index:

ViewBeforeAfter
d (60-day Calendar)1.49 s0.50 s
r (Review, 120 days)4.73 s2.18 s
14-day view from a week ago, log mode on0.38 s0.18 s
Conflict audit, 30 days0.63 s0.20 s
Free-slot planner, 61 days1.17 s0.41 s
Calendar, per day~22 ms~7 ms

The improvements in seconds can definitely be felt. When I call org-agenda, I expect a near-instantaneous response. Any longer of a delay, and it will impact my train of thought. I am opening a public discussion to share ideas before any possible upstream proposal, as I believe my org-agenda is not an uncommon size1 and the solution currently uses org-mode internals. I hope the whole community can benefit from discussion on the three points above.

I am testing the waters here to see if there are other extensive users with "large" agendas. The last relevant Google result is almost half a decade old. I can't be the only one who has run into these pain points? I am on org-mode version 10.0-pre. I appreciate your time and your thoughts!


1 fn

  1. Why is your org agenda so large?

    • Unity is one of the 5 transcendentals; org agenda has a broad scope as my only agenda. There are currently six broad areas of health and fitness, education, work, relationships (family and kids being a subtree), finance & admin (maintenance-type tasks included here), and miscellaneous.
    • "The whole usefulness of education consists only in the memory of it" β€” Hugh of St. Victor. I create flashcards with anki-connect (for the mobile aspect), inside my org agenda file. These flashcards make up >60% of the agenda file.
    • Why not separate the flashcards out? Removing subtrees with no keyword and no active stamp (i.e. all flashcards with some other headings) removed 88% of the file but shaved 12% of the time. It's beneficial to my mental model to keep resources separated from tasks, and other people's information separated from my own actions. The flashcards often need to be edited and that falls under "doing". It allows archival of the entire course with its coursework under one parent tree with org mode's chronological archiving. It can then be linked to the relevant resource heading in my org files. A balance between the qualities of 'genus' and 'time'.
  2. Have you tried org-sticky-agenda?

    • In practice, org-sticky-agenda to t means I find myself having to manually remember to refresh (doubly so if one uses clocking). Having a background refresh just isn't clean with elisp. If only elisp had concurrency like common lisp or guile.
  3. Does archiving help?

    • It certainly does. Every week I archive done PROJ's and TODO's with org-mode's chronological subtree.
  4. Have you considered org-ql?

    • Big fan of alphapapa's work; some of his other packages are mainstays in my config. Perhaps 3. falls under org-ql's scope. As of now, org-ql uses the same trick my config does by preferring todo blocks over tags "TODO". It doesn't touch org-agenda-list and what I find lacking is the abscence of per-day sections and org-ql's parsing of repeaters in timestamps.

r/emacs • • 2d ago Bravo

Announcement [ANN] Earwig: modern dictation and voice commands for Emacs

71 Upvotes

Earwig is a dictation and voice commands package for Emacs, inspired by Sacha Chua's speech recognition setup. It supports push-to-talk, streaming transcription, and a grammar of editing commands (e.g. "select last two words", "replace Monday with Tuesday in this paragraph", "format bold from results until breakthrough"). Speech is transcribed locally by Orukeet.

https://github.com/thndrbrrr/earwig


r/emacs • • 3d ago

Thank you Emacs team/devs

174 Upvotes

I've used Emacs on and off for several years but never gave it a real opportunity until now. Emacs has been part of my daily workflow for about 6 months. It's been nothing but a joy. I find this ecosystem, above all, to be stable and predictable. It always works. Thank you Emacs team!


r/emacs • • 2d ago

Upgrading to Emacs 31 β€” How stable are heavily customized setups?

31 Upvotes

I've been building a personal productivity system using Doom Emacs and Org-mode, including a custom Agenda Dashboard, folding overlays, project/resource registries, and automated workflows.

I've tried to rely on built-in functionality rather than adding lots of packages.

I'm really interested in upgrading to Emacs 31.1 because of its major improvements, but I'm concerned about long-term compatibility. I've spent considerable time building my setup, particularly the Dashboard and Agenda workflows, and I'd hate to have major updates break everything.

For those who've maintained complex setups for years:

  • How often do major updates actually break things?
  • Are custom hooks, overlays, and advice generally stable between versions?
  • What practices help keep configurations reliable long-term?
  • Is upgrading between major Emacs versions typically straightforward with Doom?

I want to take advantage of Emacs improvements without constantly having to repair my configuration.

Is this a legitimate concern, or am I overthinking the risks?


r/emacs • • 2d ago

Mickey Petersen: Announcing DreamCoder

Thumbnail masteringemacs.org
15 Upvotes

r/emacs • • 3d ago

agent-shell 0.98 updates

Post image
102 Upvotes

Latest agent-shell updates as of 0.98 https://xenodium.com/agent-shell-0-98-updates


r/emacs • • 2d ago

Ghostel scrolling issue in Doom Emacs β€” prompt disappears below window

0 Upvotes

I'm having an issue with Ghostel in Doom Emacs where long commands wrap below the bottom of the window, hiding the prompt and cursor.

What I've tested:

  • Ctrl+l temporarily fixes it.
  • Happens with both Fish and Bash.
  • stty size reports matching terminal dimensions.
  • Splitting the Emacs window seems to fix it.
  • Returning to a single window brings the issue back.
  • Hiding the mode line helps, but doesn't completely fix it.

I've also noticed graphical glitches with TUIs like btop, which render correctly in WezTerm.

Has anyone experienced this with Ghostel? Could it be related to Emacs window sizing, scrolling, or redisplay?


r/emacs • • 3d ago

Question Why does C-x t 2 (tab-new) leave the previous tab's buffer in the new tab's tab-line?

8 Upvotes

I run tab-bar-mode and global-tab-line-mode together on Emacs 32 (master build). My setup: tab-bar-new-tab-choice is "*scratch*", default tab-line-tabs-function (tab-line-tabs-fixed-window-buffers). No third-party tab packages, no advice on tab-new.

Repro: current window shows buffer X, press C-x t 2.

  • The new tab has exactly one window showing *scratch* β€” correct.
  • But the tab-line above it has two entries: X and *scratch*. X is not in this tab anywhere; clicking it just switches this window to X.

Why: tab-bar-new-tab-to (tab-bar.el) deliberately rebuilds the window to shed old window parameters β€” delete-other-windows, then (split-window nil window-safe-min-width t), then (delete-window). The comment says the new window exists "to get rid of old window parameters (e.g. prev/next buffers) of old window". But delete-window does the opposite for one of them: it records the deleted window's buffer in the surviving window's prev-buffers (that's what switch-to-prev-buffer relies on). And tab-line renders exactly prev-buffers + current buffer + next-buffers. So the new tab inherits one buffer's worth of history.

Minimal repro without tabs at all, in a fresh frame:

(set-window-buffer (selected-window) A)
(let ((w2 (split-window nil nil t)))
  (set-window-buffer w2 B)
  (delete-window (selected-window)))   ; delete the window showing A
;; => the surviving window (showing B) has
;;    (window-prev-buffers) = ((A ...))

So: is this intended, or just an accident of reusing split-window + delete-window?

Specifically I'd like to know:

  1. Since the comment already says the point is to get rid of prev/next buffers, would a (set-window-prev-buffers nil nil) after the delete-window be acceptable upstream? Or is that history intentionally kept, so C-x C-<left> in a fresh tab takes you back to what you were reading?
  2. tab-bar-new-tab-group also defaults to t, so the new tab lands in the same group as the old one (very visible with tab-bar-format-tabs-groups). Two separate "the new tab looks like a copy" surprises β€” is that the design people expect?

My workaround in the meantime (feels like fighting the framework a bit):

(defun my/tab-forget-inherited-buffers (_tab)
  (unless (eq tab-bar-new-tab-choice 'clone)
    (walk-windows
     (lambda (w)
       (set-window-prev-buffers w nil)
       (set-window-next-buffers w nil)
       (set-window-parameter w 'tab-line-buffers nil)
       (set-window-parameter w 'tab-line-cache nil))
     'no-minibuffer (selected-frame))))

(add-hook 'tab-bar-tab-post-open-functions #'my/tab-forget-inherited-buffers)

And the second question: how do you all actually manage this layer? Are you running tab-bar and tab-line together, or only one? What do you set tab-line-tabs-function to (tab-line-tabs-buffer-groups? tab-line-tabs-mode-buffers?), what's your tab-bar-new-tab-choice, your tab-bar-format, and do you still reach for tabspaces / bufler / activities / persp-mode on top? I'd like to know what a "settled" configuration looks like before I keep bolting things onto mine.


r/emacs • • 3d ago

Charles Choi: Opening Texinfo Web Pages in Emacs Info

Thumbnail yummymelon.com
4 Upvotes

r/emacs • • 4d ago

Smaller starting point for GNU emacs?

35 Upvotes

I like the idea of emacs. and as I've built out my environment I realized I want something more unified, and I see that in emacs. but I don't like the idea of having large parts of the system there that I'll never use.

it seems like my choices are to:

a) put all 200 some MB of GNU emacs on every machine I want to edit on (and have all 190MB I'm not using yet there too)

b) use another emacs entirely and lose out on extensions for the most popular version

I see emacs has a package manager, it's strange to me that the "project planner, mail and news reader, debugger interface, calendar, IRC client, and more." aren't packaged under it.

the idea of starting from a tiny base emacs and extending it after I understand what I've already got is very appealing.

edit:idk why reddit wants to put adjacent lines together, sorry for the tall post


r/emacs • • 4d ago

Easier unicode and emoji insertion in emacs

53 Upvotes

Today I just finalized a stable-ish version of compuni: a package that makes unicode and emoji insertion seamless, with an in-buffer options menu that can be invoked at any time. I'm relatively new to Elisp, so the code definitely isn't as good as it could be, but it works and helps me a lot already so I thought it might help you guys too :3

GitHub: https://github.com/kode-tar-gz/compuni/


r/emacs • • 5d ago

Terminal multiplexer (Tmux/Rex) in Emacs and Ghostel updates

101 Upvotes

One of the first and most often requested features for Ghostel was proper tmux support like iTerm2 has. There were again a lot of changes in Ghostel over the last month, and one of them is a proper public API that you can use to write your own multiplexer package on top of it. This means that you can now make a terminal that has no process. Check the readme for more info on how to integrate.

With that in place, there are two new packages making use of it: ghostel-tmux, an iTerm2-style tmux integration, and rexel, which uses Rex, the new multiplexer from superlogical, as a backend. Rex currently only has a macOS app, so with rexel you have a full-featured client for the Rex server on Linux/FreeBSD/Windows.

ghostel-tmux and rexel are still very new, so I'm happy to hear any feedback.

On the Ghostel side, u/baokaola completely rewrote the Kitty graphics support. The old version was fine for simple cases but dropped transparency and stretched some images. The new one does transparency, overlapping images and cropping and images survive in the scrollback. yazi, timg, kitten icat and friends should just work, and Claude Code now shows images without the need to set an extra environment variable.

Then there were a few smaller additions:

  • ghostel-shell-command: like async-shell-command but with a real TTY. With `ghostel-shell-command-global-mode` that also covers dired and project.
  • ghostel ssh HOST: shell integration and terminfo on the remote without touching its rc files.
  • A mode line indicator and ghostel-status-next to jump to the terminal that is waiting for you, e.g. a coding agent asking for permission.
  • libghostty-vt 1.0: faster parsing and up to 30% more scrollback in the same memory.
  • file:// links open at the line (#L23), and lots of line mode and evil-ghostel fixes.

As always, feedback of any kind is very welcome :)


r/emacs • • 5d ago

I built a web development ecosystem with Emacs Lisp

75 Upvotes

In June I posted I ported GNU Emacs 30.2 to the browser with WebAssembly. Thank you for many comments. I continued the hack, and now it can do two new things:

  1. Subprocesses run inside the browser tab.
  2. You can write a web app in Emacs Lisp, and Emacs runs it in the browser.

1. Subprocesses in the tab

Last time I wrote that the browser does not have normal POSIX processes, so Emacs features that depend on external commands do not work. Someone asked "Can it do M-x compile?" and I answered that shell/process access is the big missing piece.

Now it works. wasmacs has a small kernel inside the tab, and it runs real programs as processes (pipes, signals, fork, exec):

  • BusyBox ash and about 150 commands
  • git 2.52, GNU grep 3.12, GNU diffutils
  • CPython 3.14

Everything runs inside the page, not on a host machine. So M-x compile, M-x shell, eshell, M-x term, M-x grep, vc-git, Ediff and run-python work in the browser. Magit also works if you install it with package.el. SQLite is linked too.

M-x compile inside the browser tab. GNU grep and CPython run as subprocesses, and the compilation buffer links to matches.
M-x shell inside the browser tab, showing a Git commit, GNU grep, CPython, and a pipeline. The mode line on the right shows vc-git.

2. Web apps written in Emacs Lisp

Some people joked that Emacs will become an Electron app. I went the opposite direction: the web app is written in Emacs Lisp πŸ˜„

The demo is Parens, a YouTube-like video browser. It has:

  • a home grid, and a watch page with the embedded player
  • search, channel pages, history, "watch later"
  • settings, English and Japanese

It is about 2,400 lines of Emacs Lisp, plus about 180 lines of JavaScript glue (YouTube player, clipboard, global keys).

live: https://modeverv.github.io/elisp-react-youtube-similar/ (desktop Chrome. First visit downloads about 5 MB of Emacs.)

Parens home. GNU Emacs running in the tab renders the video grid from elisp-react components.
The Parens watch page with an embedded YouTube player, the Up next list, and Watch later.

It is made of four parts, all Lisp:

  • wasmacs: The real Emacs runs in the page. A page can send Lisp and get JSON back.
  • elisp-react: React (like the 2013 version) in Emacs Lisp. It has the following:

    • components with props and state, and a jsx macro
    • a keyed reconciler, effects, context, async/await
    • JavaScript only applies the DOM operations that Lisp computed. No build step, no Node. You just list your .el files in <script type="text/emacs-lisp"> tags.
  • elisp-studio: Emacs and your app side by side in one tab.

    • C-x C-s reloads the changed code into the running app, and the state is kept.
    • Flymake shows byte compiler warnings while you type.
    • You can also edit with your own Emacs, and the page follows your saves.
  • elisp-next: A Next.js-like layer.

    • A file in pages/ is a URL, and a file in api/ is a server route.
    • shared/ has types that both the page and the server check.
elisp-studio live reload. The title, code, and stylesheet change while the stopwatch keeps running.

A component looks like this:

(react-define-component 'Counter
  :initial-state (lambda (props) (list :count (or (plist-get props :start) 0)))
  :render
  (lambda (self)
    (jsx (div (:class "counter")
           (p (format "Count: %d" (react-state self :count)))
           (button (:on-click (lambda (_event)
                                (react-set-state self :count (1+ (react-state self :count)))))
             "+1")))))

(react-mount (jsx (Counter (:start 3))) "#app")

Files of Parens:

pages/index.el           /
pages/watch.el           /watch?v=ID
pages/channel/[id].el    /channel/ID
api/later.el             GET and POST /api/later
shared/parens-types.el   types that the page and the server both check

The server can also be Emacs. In the Parens "server mode", a native Emacs serves the page and reads the RSS feeds of the channels (a page cannot read them because of CORS). Both sides exchange printed Lisp data, not JSON, and load the same type definitions.

Parens server mode, served from Docker by GNU Emacs 29.3. Four Emacs workers run behind Caddy.

Deploy

  • Without server.el: It is a static site. GitHub Pages or any web server is OK. Parens is on GitHub Pages.
  • With server.el: You only need bash and GNU Emacs 29 or later. Any Linux machine with Emacs, or Docker. No Node, no npm, no build on the server.
  • run.sh: The studio downloads your project with run.sh. Run ./run.sh, and Emacs becomes the web server.
  • Proxy and systemd: Caddy and nginx configs and a systemd unit are included. WORKERS=4 ./run.sh runs 4 Emacs processes for 4 cores.
  • Docker: Dockerfile and docker-compose.yml are included.

I tested it with Docker before this post. The setup was Ubuntu 24.04 with its own Emacs 29.3, Caddy in front, and 4 workers. Two apps worked from Chrome:

  • the studio's template app
  • Parens server mode: the feeds and "watch later" work, and the data is kept after restart

The screenshot above is Parens from that container. Also the CI runs this Docker test (HTTP and HTTPS) for every push.

Last time I wrote "We need the real Elisp engine." This is what the real Elisp engine can do in the browser.

A bug I liked

I wrote Parens to find what is missing for a real app. I found 57 gaps, and all of them are closed now. My favorite one: in the page's Emacs, no hook was running at all. Here is why:

  1. The page starts Emacs in batch mode, and batch startup runs until kill-emacs.
  2. This ends main(), but the WebAssembly runtime is still alive.
  3. On the way out, shut_down_emacs sets the C variable Vrun_hooks to nil.
  4. After that, every run-hooks returned immediately and silently. Also the hooks called from C.

The fix sets Vrun_hooks back when a request comes.

Limits

  • It is still a hack. Please do not build your business on it.
  • Download: An app downloads about 5 MB on the first visit. The studio's editor Emacs is about 150 MB (then cached).
  • Memory: Each tab reserves 1 GiB memory for Emacs. Parens used 265–335 MB in desktop Chrome.
  • Browser: I tested only on desktop Chrome, not on a real phone.
  • Deploy: I load-tested with Caddy and nginx on Mac, and tested it in Docker. Not yet on a real server with HTTPS, and not with the systemd unit.
  • Network: No raw sockets, so Emacs in the browser cannot listen on a port. package.el and git over network need a small Chrome extension (companion).
  • No server-side rendering, no code splitting.

Links

My code is MIT. Emacs and the bundled programs keep their own licenses, and the sources are published.

I made this hack to give Emacs users something fun to play with again. Emacs users, please give it a try. I want to hear what you want to build with Emacs Lisp in the browser, and what is missing.


r/emacs • • 4d ago

Tim McGilchrist: curry: a modern Emacs mode for Haskell

Thumbnail lambdafoo.com
15 Upvotes