arzab · 2022-08-15 21:13
How is the emacs ui implemented?
does it use curses?
Is there a framework?
How is emacs' amazing and awsome ui created. I NEED TO KNOW!!!! Is it written in c?
How does one write a program like emacs ? I mean at the rudimentary level?
KaranasToll · 2022-08-15 21:46
There is a more recent emacs like editor called Lem written in Common Lisp that uses ncurses. I think the graphical emacs uses gtk.
Sudo_Brew · 2022-08-15 21:58
Here's a GitHub mirror of the source code: https://github.com/emacs-mirror/emacs
As a whole, it's mostly in Emacs Lisp but most of the lower-level code is in C. I'm not well versed in any of the internals but an educated guess is that much of the UI is in here: https://github.com/emacs-mirror/emacs/tree/master/src
dpoggio · 2022-08-16 04:56
I think the PO asks for the terminal UI, the one you start with `emacs -nw`.
arthurno1 · 2022-08-16 07:07
Emacs GUI has bindings to some basic gui stuff for scrollbars, buttons ,menus and alike to several different toolkits, different versions of Gtk, Motif, and win32 for example, which are enabled/disabled at compile time. However, Emacs is bot a typical GUI application as MS Word or Gimp. Emacs is more or less an implementation of a character based terminal interface similar to a terminal. If you turn off gui stuff, the main Emacs GUI window is is similar to xterm, but with some multimedia capabilities like displaying images. You can think of Emacs GUI as virtual terminal with text editing capabilities :-). I don't know if that is the best analogy, but I hope it explains a bit how it works. For the non-gui Emacs, they don't use nurses, but do their own control of terminal, similar as how nurses does it, or bash or any other application that controls the terminal (emit control codes). I am not actually an expert in Emacs, if I am wrong I am glad to learn more about it.
wasamasa · 2022-08-16 13:23
It uses terminfo/termcap for the part of reimplementing ncurses. Their functionality is provided by a separate library or by ncurses. The main workhorse is `tputs` which prints a terminal control code. See `cm.c` and `term.c` for usage.
akirakom · 2022-08-16 14:33
See `--with-x-toolkit` build option of Emacs. It currently supports gtk2, gtk3, motif, athena, and lucid.
emacsomancer · 2022-08-17 14:48
There's an interesting discussion of this by Daniel Colascione: Buttery Smooth Emacs (a Facebook post from 28 October 2016 - [https://www.facebook.com/notes/10107017870677858/](https://www.facebook.com/notes/10107017870677858/) ).
Here's a version in org-mode: [https://paste.debian.net/1250782/](https://paste.debian.net/1250782/)
**Edit: updated org file to restore the original hyperlinks.**
# Links to other discussion:
* [https://www.reddit.com/r/emacs/comments/5a4wer/buttery\_smooth\_emacs/](https://www.reddit.com/r/emacs/comments/5a4wer/buttery_smooth_emacs/)
* [https://news.ycombinator.com/item?id=12830206](https://news.ycombinator.com/item?id=12830206)
emacsomancer · 2022-08-17 18:01
(I'm curious what the pure GTK branch of Emacs does, w.r.t. the byzantine pipeline described by Colascione.)