reddit / emacs
is emacs a terminal program?
sprayfoamparty · 2022-06-16 23:40
I am confused if I am using the correct emacs. Whenever I see [screenshots of emacs](https://duckduckgo.com/?q=emacs+screenshot&kl=wt-wt&kp=-2&iax=images&ia=images) it is a terminal program. But when I launch the [package](https://archlinux.org/packages/extra/x86_64/emacs/) installed from arch repos, it is a GUI program with menus and everything. I thought you weren't supposed to use mouse with emacs. Even when I launch it from the terminal. It sort of has a terminal inside it?
Is it correct? I looked at all kinds of documentation and nobody is mentioning this but I don't now what to look for. Can someone confirm to me what emacs is supposed to look like and how it runs?
nv-elisp · 2022-06-16 23:41
It's both.
[deleted] · 2022-06-16 23:50
[deleted]
MangyCanine · 2022-06-16 23:53
I’m not sure why you’re being downvoted, but it really is both. On linux, if `$DISPLAY` is not set, emacs would run within the terminal. If it was set, emacs would run as a GUI. If you use `emacsclient`, it’s possible to do both simultaneously. I’m pretty sure there are platforms where emacs runs in GUI-mode only.
xtifr · 2022-06-17 00:28
It *started* as a terminal program, and it can still be used as one, but it's also had GUI support for *ages!* The GUI support is actually optional (you can still compile a terminal-only version), but since the GUI version *also* works in a terminal, few people bother. (Also, GUI mode can do a lot of things that terminal mode can't, or can't do well, such as displaying PDFs.)
These days, terminal mode is mostly only used by folks who need to edit files on a remote server, and, for whatever reason, don't want to use Emacs's built-in remote editing features. (There's also a few folks who think that running in terminal mode is some sort of sign of geek superiority, but they're silly and can be ignored.)
A lot of those screenshots you're looking at are probably actually GUI Emacs with the toolbar and menu disabled. I turn off the toolbar myself, but even after many years of using Emacs, I still find the menu useful for finding obscure, rarely-used features when I need them.
sprayfoamparty · 2022-06-17 00:39
not a bad idea. I hate watching people type stuff; I can't follow it especially as they always have monitors 6x the size of mine and fullscreen their terminals so I can't see what is happening. so I didn't try that before but now I did just to look.
it took FIVE videos to find someone who was showing something like what happens when I open emacs and it was [this one](https://invidious.snopyta.org/Iagbv974GlQ?t=156).
hey note to everybody: if you are going to make "absolute beginner's guide", you should use the default set up even if it is corny.
JohnathanDee · 2022-06-17 00:59
YyyyyyyyyyyyyyyyyyuuuuuuuuuuP.
It's a TUI first. But the GUI is just so... *usable* I reach for it first.
Best of both worlds run Emacs as a server and use `emacsclient` to connect in both the GUI and the terminal. Edit the same buffer in both. Heheh.
JohnathanDee · 2022-06-17 01:01
That's just false. Unless I'm nobody? I learned it in the terminal and still reach for it every day. `emacs-nox` is a thing. It's installed on every host at work.
JohnathanDee · 2022-06-17 01:09
That's because graybeards like myself learned Emacs when the GUI didn't exist or was just... Not very good.
Learning Emacs in the terminal was *required* for all my C courses in uni. Not the GUI. The terminal. Why? For the best editing experience?
No. To make us think like programmers. To force us to learn the tools without a mouse.
Look, you wanna learn to play the piano? Play your scales. Didn't play your scales? Never got chops
fazalmajid · 2022-06-17 01:13
Emacs running on a terminal can have better latency than in a GUI, specially with X11, but only if you select the right terminal emulator.
Remote editing is better done with Tramp.
[deleted] · 2022-06-17 01:24
[deleted]
copperbranch · 2022-06-17 01:54
People are not using the gui version *because* of the mouse support. The gui version has a lot of advantages unrelated to mouse.
Blanglegorph · 2022-06-17 03:05
> Font rendering, image rendering, clipboard integration, variable fonts
Not everyone cares about looking pretty, which is three of those. Clipboard integration hasn't been a problem for me in the terminal. That article doesn't make a particularly compelling case either. And do you have anything actually stating emacs is slower in a terminal? Without having to do a bunch of font and color bullshit, one would think it could be faster.
LionyxML · 2022-06-17 03:23
On a terminal call it with: emacs -nw (you will sure have emacs on termina since some distros link the emacs command directlly to gui mode).
[deleted] · 2022-06-17 03:43
[deleted]
Acebulf · 2022-06-17 03:56
I like terminal emacs for edits where nano would have been used instead.
JohnathanDee · 2022-06-17 03:58
I don't watch videos. Sorry. I don't care about font rendering.. my Emacs uses the system monotype, and so does my terminal (guake).
I rarely render anything besides plain text in the GUI. When I do, I use the GUI.
I use both. Sometimes at the same time. I can open a TUI in the terminal with `emacsclient -t` and edit the buffers I'm editing in the GUI, or vice versa. It's all Emacs
JohnathanDee · 2022-06-17 04:00
Yah I'm used to pasting in the terminal. Add shift. It's not hard
JohnathanDee · 2022-06-17 04:02
I'm glad to hear that Emacs has appeal for non-technical users!
Blanglegorph · 2022-06-17 04:08
> I do want proportional font rendering, inline images, and PDF rendering. I am using Emacs as a writing environment.
That's good for you. Then it makes more sense for you, personally, to use the gui version. It doesn't make the terminal version "sub-optimal". If you had more experience working with other tools in the terminal, you might be able to think of why using an editor integrated into that environment is useful. Possibly not for you personally, but in general. Then, you might have typed something like, "The gui and terminal versions offer different benefits for different use cases, here are some of them and what makes the gui version right for me." It also seems like you dropped the "worse performance" bit.
I use the gui version because I have to use Windows for work. Even with that, I don't think I've ever opened an image with it. Or a pdf, but maybe I will now that I think of it. If I were on linux? Probably be in a terminal, where most of my other tools are.
_viz_ · 2022-06-17 04:17
>I thought you weren't supposed to use mouse with emacs.
Don't fall for this dogmatic belief. Emacs has a lot of thoughtful mouse commands, there are no sandmen here so feel free to use them as you see fit.
sprayfoamparty · 2022-06-17 04:20
> It's a TUI first. But the GUI is just so... usable I reach for it first.
> I learned it in the terminal and still reach for it every day.
7890yuiop · 2022-06-17 04:24
> A lot of those screenshots you're looking at are probably actually GUI Emacs with the toolbar and menu disabled.
Yes, this.
Aside from the fact that a heap of the linked screenshots are also blatantly GUI Emacs, with menus, toolbar, scrollbars and everything, the chances are high that most of the others are also GUI Emacs, even if it's less obvious.
It can be pretty hard to tell the difference between terminal and GUI emacs frames if the latter has none of the GUI-specific UI enabled, and the former is using the same colours and font.
_viz_ · 2022-06-17 04:25
>Not everyone cares about looking pretty, which is three of those.
No, sorry but good font rendering can make or break the deal for some scripts and some scripts simply cannot be squashed into a monospace font [*]. "Looking pretty" is really 1½, not three.
---
[*] https://github.com/monotty/fonts https://directory.fsf.org/wiki/Intlfonts http://varamozhi.blogspot.com/2006/02/monospace-fonts-for-malayalam.html http://archives.miloush.net/michkap/archive/2006/08/23/712587.html
The monotty font is barely readable IMHO. Maybe for a native speaker of a language that uses the Devanagari script, it might be tolerable but as someone who can sort-of read the script, it is very hard. Likewise, the Devanagari glyphs in GNU Intlfonts is barely comprehensible.
sprayfoamparty · 2022-06-17 04:25
curious what sort of computer you are using that is slowed down by colors and variable font sizes?
CorysInTheHouse69 · 2022-06-17 04:28
Nearly all screenshots of emacs are not of emacs in the terminal. It’s just emacs with gui buttons turned off
Blanglegorph · 2022-06-17 04:30
I don't think I ever noticed a big difference (except in startup time). But apparently the guy I was responding to thinks it runs slower in a terminal, which would be the opposite of what I would expect if there were a difference. That's why I asked him for a source.
Blanglegorph · 2022-06-17 04:34
I've seen comments in languages other than English, but I've never seen code in something other than English on a computer I was using. Needing to open files or otherwise show text written with the Devanagari script seems like a good use case for the gui though.
ramin-honary-xc · 2022-06-17 04:39
You can choose TUI or GUI, Emacs does both on most Linux distros, unless you deliberately install the non-GUI version of Emacs -- on Debian, you could install the `emacs-nox` package, which is the Emacs with no X11 protocol GUI support.
If you have GUI support for Emacs, you can choose TUI only by running Emacs with the command `emacs -nw` ("no windows"), otherwise it runs the GUI version by default.
You can run an Emacs server (`M-x server-start`) and both TUI and GUI sessions can connect to the server. The `emacs-client -t` command runs a client session in TUI mode. The Emacs Client will run in GUI mode by default.
I prefer GUI mode because I like having multiple fonts, and the ability to view images in an Emacs window. You also have a wider range of key bindings in GUI mode, some key chords are not possible in a terminal.
Other people prefer TUI mode only because it tends to run a bit faster, and they tend not to need multiple fonts or images, and the terminal Emoji support is good enough.
_viz_ · 2022-06-17 04:51
>I've seen comments in languages other than English, but I've never
>seen code in something other than English on a computer I was
>using.
Well, well, Ezhil (எழில்) is a programming language whose keywords are
Tamil only! You can read more about it here:
https://www.researchgate.net/publication/45864706_Ezhil_A_Tamil_Programming_Language.
I think part of the reason why there are so few of it is because of
the lack of manpower, and because most input methods are truly awful
when compared to just writing the language on paper. This problem
only compounds more if the language is phonetic since then you end up
with being able to transliterate a single word in multiple ways. I
wanted to make a Tamil IM which utilises a dictionary but I was unable
to find a dictionary. :(
>Needing to open files or otherwise show text written with the
>Devanagari script seems like a good use case for the gui though.
Yes, indeed. GNU Emacs actually makes the Indic locales usable when
it comes to CLI programs.
Alan_Shutko · 2022-06-17 04:54
I've been using Emacs as a GUI program since the 90s and it had significant benefits over the terminal back then. Terminals caught up in terms of color support relatively recently. If you go back to the Lisp Machines, they had mice. They had GUIs. The capabilities have been around a long time.
So Emacs, as /u/nv-elisp says, is both. The question is less "Is Emacs a terminal program?" and more "Do you prefer a terminal program?" Nowadays you can use the mouse to some extent even within a terminal and you can turn off all the GUI fanciness even if you are outside the terminal. It's up to you.
Blanglegorph · 2022-06-17 05:14
> I think part of the reason why there are so few of it is because of the lack of manpower
I don't think lack of manpower really has anything to do with the lack of languages written in scripts other than English. As far as I know, a large number of programming languages do support non-ascii unicode characters in identifiers, meaning that only the built-in keywords would have to be ascii. Σ is a valid identifier in python, as is ツ.
The problem probably stems more from there not being a better language than English to write in for portability. A Bulgarian programmer could write in cyrillic, and a Japanese programmer could write in whichever script (what is it, three they have?) they feel like that day - but, why? Suddenly, their portability would go from worldwide to national. What happens when that Bulgarian company wants to work with a company outside Bulgaria? Or it if even just wants to hire developers from outside Bulgaria?
Some countries are big enough that using non-latin scripts might actually make sense, but at this point you would be moving against the inertia of the existing communities of developers in those countries who already use ascii-based languages.
_viz_ · 2022-06-17 05:27
Ah, indeed. I forgot one could simply use a preprocessor for keywords. Although some languages might have problems with that problem due to language structure? But yes, portability is the biggest show stopper. I don't see a problem with using a local language for a codebase that wont be used "outside" but I'm not a developer so what can I tell.
Anyway, thankfully humans arent so dumb that they are unable to understand and internalise concepts and thoughts in multiple languages. For myself, it is a mix of three languages in varying degrees---Tamil, English and Hindi.
jacmoe · 2022-06-17 05:35
I am glad that you are glad ;)
But I am not exactly a non-technical user : [https://github.com/jacmoe?tab=repositories](https://github.com/jacmoe?tab=repositories) and [https://jacmoes.wordpress.com/2019/09/24/creative-writing-with-emacs/](https://jacmoes.wordpress.com/2019/09/24/creative-writing-with-emacs/)
​
Reddit ... it is what it is. Here I can always find people to disagree with :)
mrprofessor007 · 2022-06-17 06:19
Huh, when I started learning it, folks told me that certain things don't work well on the terminal😐.
nu0or · 2022-06-17 08:02
personally, i only use terminal emacs.. gui comes with the whole kitchen sink, it is not needed.
deaddyfreddy · 2022-06-17 08:44
they really don't
deaddyfreddy · 2022-06-17 08:52
> The terminal
has nothing to do with being a programmer, it's just a bunch of legacy low level escape codes nobody wants to think about.
> To force us to learn the tools without a mouse.
What's wrong with mouse? It can extend input capabilities a lot, so it's worth to use in some cases.
> Look, you wanna learn to play the piano? Play your scales.
Wanna be a performer? Sure. But a lot of great musicians never learned scales, actually.
deaddyfreddy · 2022-06-17 08:54
> There's also a few folks who think that running in terminal mode is some sort of sign of geek superiority, but they're silly and can be ignored.
I couldn't ignore that one, though :)
LordOfSwines · 2022-06-17 12:59
In most of those screenshots you are looking at the GUI version. I've always used the GUI and I know of very few people that use the TUI.
There are plenty of reasons for me to use the GUI
* Some keybinds will not work in the terminal.
* GUI allows for inline latex previews (images in general) for example in .tex or .org documents.
* Variable pitch fonts
notionsaregood · 2022-06-17 13:17
I use emacs on the daily without my hands leaving the keyboard almost ever unless I'm going to click another program or something. What are some mouse commands you use in emacs every day ? I guess the only one I can think of is maybe scrolling?
Tenn1518 · 2022-06-17 13:23
[This article](https://blog.aaronbieber.com/2016/12/29/don-t-use-terminal-emacs.html) is good reading for the reasons why most Emacs users just use the GUI. It convinced me when I was starting to use Emacs for the first time.
_viz_ · 2022-06-17 13:26
See this post https://www.reddit.com/r/emacs/comments/uxh0dy/a_mousedriven_emacs/. Besides the one mentioned there, I also use:
- mouse-1 and its multiple click variants to set the region.
- mouse-3 and double-mouse-3 to save and kill the region respectively.
- I have an in-house Acme tag implementation cooking. The window side of things is mostly done, I have to write generic commands and commands for major modes now. I also have to write a drag command for mouse-2.
There are also a whole load of other context dependent commands.
guygastineau · 2022-06-17 13:41
Here here! Plus I need me some of that sweet `C-c C-e l o` in org. Geiser also supports inline native image values when using the racket backend.
WaitingForEmacs · 2022-06-17 13:41
>These days, terminal mode is mostly only used by folks who need to edit files on a remote server, and, for whatever reason, don't want to use Emacs's built-in remote editing features.
Just to expand this a little as a life long `-nw` flag user, there are a few more reasons:
1. If you have spent your entire career working on different remote machines then it is very nice to be able to ssh into a machine and re-attach to a tmux (or screen) session that already has emacs up and running at the exact same place where I had left-off the day before.
2. Increasingly the clients that I am using for work when traveling are very lightweight, such as an iPad Pro, that does not have native emacs. Being able to open a connection (I really like Termius for ssh on iOS) and still have full access to my emacs workflow is really nice.
3. We are usually not just "editing" code on the remote servers, but running it there too. So it makes a big difference when I can re-run a babel code block in R or python using the power of a truly vast linux box instead of my laptop.
cazzipropri · 2022-06-17 14:02
Emacs can run well in a terminal or in an X-Windows environment.
The experience in a terminal is less fancy than on X-Windows, as of course you don't have graphical elements like icons and buttons, but ideally you should be able to access all the functions.
It's easy to get confused because most users of emacs within a graphical X-Windows environment turn off all graphical elements (scroll bars, drop down menus, button ribbons, etc.) for best real estate usage, so it's harder to distinguish the two.
The way the terminal deals with keystrokes is different than X-Windows, so you might have key bindings that work on one environment and not in the other, or vice versa.
For a sample view of what emacs can look like in a graphical environment, look up SystemCrafters on YouTube.
treeblahh · 2022-06-17 14:26
I use lsp-mode’s follow definition with the mouse while I’m scrolling through files.
xtifr · 2022-06-17 14:54
3 is not actually an issue! Emacs runs sub-processes in the directory of the current buffer, and, therefore, by necessity (and conveniently) runs them on the same host as the buffer! It would be nearly useless if it didn't work this way, since most of us who work on remote systems are building code *for* those remote systems!
1 & 2, however, were already covered by my "for whatever reason, don't want to use Emacs's built-in remote access features." But I will say, based on my experience, that you're lucky that the company even has Emacs installed on their hosts, *and* that they allow you to install the various Emacs packages you should need on top of that.
WaitingForEmacs · 2022-06-17 14:58
Wow! I have been using emacs since the early 90s and I did not know that. I have always just had a big terminal on my screen logged into whatever machine I was working on and had no idea it could do that. I will strongly consider using a local version of emacs more often now. Thanks!
[deleted] · 2022-06-17 15:08
[deleted]
[deleted] · 2022-06-17 15:08
[deleted]
[deleted] · 2022-06-17 15:08
[deleted]
[deleted] · 2022-06-17 15:08
[deleted]
[deleted] · 2022-06-17 15:10
[deleted]
[deleted] · 2022-06-17 15:11
[deleted]
[deleted] · 2022-06-17 15:11
[deleted]
[deleted] · 2022-06-17 15:11
[deleted]
[deleted] · 2022-06-17 15:13
[deleted]
[deleted] · 2022-06-17 15:15
[deleted]
[deleted] · 2022-06-17 15:15
[deleted]
notionsaregood · 2022-06-17 15:38
Cheers for the post; I think taking a look at it there's nothing that really jumps out at me as very useful to me personally, but if it works for you then more power to you.
Edit: I do wonder as to why people were so sensitive about me indicating that it was not for me lol. Utterly childish behaviour.
steve_b · 2022-06-17 15:56
>Remote editing is better done with Tramp.
I've never been a fan of Tramp. Painfully slow when dealing with large files. On the other hand,
ssh -X <remote host>
emacs
lets you edit large files on a remote server with ease, as well as run shell commands on the remote, etc.
[deleted] · 2022-06-17 15:56
[deleted]
arthurno1 · 2022-06-17 22:26
In Emacs, the GUI is a TUI too :).
xtifr · 2022-06-17 22:38
I mean, it's certainly worth trying, but Tramp *does* have its own set of issues (especially with third-party packages, which aren't always designed with Tramp in mind). While I generally prefer Tramp myself, I *do* think that "I work on remote systems" is still a perfectly valid reason for using terminal Emacs.
IOW, I'm not trying to get you to change, but it's good that you know it's not as bad as you thought. :)
arthurno1 · 2022-06-17 22:58
> Learning Emacs in the terminal was required for all my C courses in uni.
Really?How many "C courses" are at your UNI? At my there was one C course and one C++ course. C was used in other courses (network, os, hardware, etc), but only one course teched C programming itself. By the way, in all my courses at UNI not a single course had a rule about which text editor we should use. Certainly not the C course. Why would they? I used Emacs, our professor used vi. They only cared about the code I turned in.
> Not the GUI. The terminal. Why? For the best editing experience?
Emacs text editing experience is pretty much the same or better in GUI then in terminal. Mouse has nothing to do with it.
> To make us think like programmers.
I wonder how mere typing in a window can make you think like a programmer? You do realize that a vritual terminal is just another X11 window with much worse text editing capabilities than Emacs GUI? Emacs terminal version improve on the terminal editing, but it lacks some timesaving features, like previewing images directly in the editor.
It is like saying, we write with pencil on a piece of paper to make us think like writers. The medium you use to write down your thoughts is just that, a medium, and nothing more.
> To force us to learn the tools without a mouse.
So using tools without mouse is a goal in itself? Why? I am actually using GUI Emacs without Mouse most of the time. How about that?
> Look, you wanna learn to play the piano? Play your scales.
What does playing instrument and playing scales has to do with typing text in Emacs window? It is pretty much same experience in GUI and TUI when it comes to inputing text. That is not very useful comparison you are making there. I would rather say it is an erronous metafor.
WaitingForEmacs · 2022-06-17 23:01
I have definitely used Tramp but if I do want to use local emacs then I tend to mount the drive remotely via smb. Still, I learned something new and exciting today. Thanks!
arthurno1 · 2022-06-17 23:09
> I use the gui version because I have to use Windows for work.
What? Emacs does not work in terminal on Windows? It worked for me when I was using Windows, even over Putty, some 20 years ago.
> If you had more experience working with other tools in the terminal, you might be able to think of why using an editor integrated into that environment is useful.
Maybe if you had experience working with other tools in the terminal, you might be able to think of why using an editor with that environment integrated into the editor is useful. Possibly not for you personally but in general. Then, you might have typed something like, "The gui version saves lots of time since it integrates all those small terminal utilities into same interface so I don't have to context switch between different tools and possibly different windows and environements.".
I don't know, Maybe :-). Sorry for parafrasing you, but just trying to show you how biased and subjective your comment was.
> If I were on linux? Probably be in a terminal, where most of my other tools are
I am on gnu/Linux almost 100% of my time, and probably 80% of my time in Emacs, where most of my tools are.
00-11 · 2022-06-18 03:02
Emacs is a terminal illness. There's no way out, once you get it. :-)
Blanglegorph · 2022-06-18 04:08
> What? Emacs does not work in terminal on Windows? It worked for me when I was using Windows, even over Putty, some 20 years ago.
*I* don't work in a terminal on Windows (mostly). The tools I regularly use in the terminal are Linux tools. I do use wsl sometimes, but for the most part not. So, when I went to install emacs, the gui was the easier way to go. For my circumstances, that was already enough to make it a better choice.
As for the rest of your comment, you misunderstand me. Partially because the person I replied to deleted their comment so you didn't see it. Their comment basically stated that using emacs in a terminal is worthless and only inferior with no benefits or unique capabilities, which is obviously a stupid statement; thus my reply pointed out that both offer benefits. I can think of plenty of reasons why gui emacs is useful and superior for many people. I use gui emacs (again, on Windows at least). In fact, I suggested making that statement:
> The gui and terminal versions offer different benefits for different use cases
Given my suggested statement, exactly what part of my comment are you pretending is "biased and subjective"?
And, just to respond to one of your points:
> The gui version saves lots of time since it integrates all those small terminal utilities into same interface so I don't have to context switch between different tools and possibly different windows and environements.
The terminal already integrates all those small utilities into one window and one environment. The gui also does this in a different way, but both do it.
dpoggio · 2022-06-18 20:04
Some of the screenshots have buttons or icons turned on. People just assume that anything with text and a dark theme is a terminal.
_viz_ · 2022-06-19 05:25
>Edit: I do wonder as to why people were so sensitive about me indicating that it was not for me lol. Utterly childish behaviour.
This subreddit is notorious but not that bad in the grand scale.
nu0or · 2022-06-19 15:54
pretty bad article. sure, if you view emacs as a generic editor with some plugins (like 99.999% of posts here) it makes sense.. but if you view emacs as a lisp interpreter and use it like it was built to be used, then the gui has zero advantages
7890yuiop · 2022-06-22 11:05
There are definitely performance benefits to using a remote instance in a terminal instead of using a local instance + tramp, so if you're doing a lot of work in Emacs on a host then I would always *prefer* to ssh in. Aside from occasional short-lived connections (where I find tramp to be incredibly convenient), the circumstance where I find tramp wins is if my network connection is *extremely* slow, or unreliable. Otherwise (i.e. when I'm getting acceptable response times from the remote instance over ssh) I find the delays introduced by tramp are too annoying to suffer for prolonged durations.
YMMV. I use both ssh and tramp, and am tremendously glad of both options.