by teucris · 3y ago · 0 comments
I'd add that it isn't only about preferences. Obviously if it works equally well either way, you save time and energy by just adapting yourself to your tools and appliances and moving on with your life. But doing so sort of sets a ceiling on what you'll ever imagine any tool can do... This touches on what I'm getting at: https://djrobstep.com/posts/programs-are-a-prison
I have used vanilla Emacs for a long time with only a couple of packages installed (basically flyspell and web-mode) and everything worked for me although it was quite boring. That’s because I managed most of my dev workflow outside of Emacs. The JS dev server took care of reloading and transpiling, the linter ran as a test step and I used git on the command line for version management.
These days I do a lot of backend work, most importantly REST APIs. So have to tweak server code, restart the server (not always written in JS), test out new end points. So I am using the built-in „compile mode“ running a bash script automatically deploying my code changes using ssh upon two key strokes (C-c C-r). Emacs returns syntax errors including file names and lines, so I can jump straight into the code to fix the issue. Once running I switch over to a „restclient.el“ session to try my code. With another two key strokes (C-c C-c) I execute a request (however complicated) and receive the JSON response in a temporary side buffer which I can filter using „jq“ with another key stroke thanks to restclient-jq.el. I can inspect runtime errors on the server by opening the remote log file using TRAMP mode (alternatively, I open a „term“ session and invoke „tail -f“). Once the code works I press „C-x g“ to switch over to „magit“ to stage or commit my changes. If I have to work on two or three things in parallel I use „perspective.el“ to maintain something akin to virtual desktops, so I don’t have to re-order my buffers all the time. I also do teaching on REST APIs which I do using „org-mode“ together with „org-babel“ and „org-tree-slide“ allowing to inline actual restclient.el sessions among text or graphical slides. I also use org-mode for technical documentation including executable code and for explorational SQL development. You see, in Emacs many packages just glue together seamlessly thanks to its brilliant API that stood the test of times.
I didn’t start using all of this on a single day but Emacs sucked me into its eco system very slowly until I just couldn’t imagine using anything else anymore. It just takes time to get to know these things and getting comfortable with Emacs‘ configuration system.
I am a long time emacs user but I'm not aware of some of the modes you mentioned above and it would be awesome to see a video tutorial!
You'd probably have to "dedicate" yourself to it for a month or more (and having a "mentor" or support group that can answer questions and telling you there's an easier way to do it would help).
It was MUCH more powerful (relative) when we didn't have much beyond a terminal emulator.
Last paragraph though I do not agree with at all.
If you don't see that as a fun past-time activity, then I would not recommend emacs.
For instance, (in my emacs email client) I just made a change where if I want to search the subject I am looking at, and it has a #XXX in it, then the subject search is just that number. Makes me able to quickly load up all emails related to that ticket. This makes me happy.
Also: same keyboard interface to everything.
Yes, I love this.
Relatedly emacs is good if you find small annoyances or imperfections hard to "just deal with" and have the time and skill to customize or "craft" your emacs.
I still have to look up how to add hooks (decades into using Emacs as my primary editor).
But using the same shortcuts in every readline prompt is just so comforting.
> If you don't see that as a fun past-time activity, then I would not recommend emacs.
If you don't see that as a fun past-time activity and still want to use emacs, then I would recommend spacemacs.
However, Emacs distributions like Doom Emacs or Spacemacs are definitely more approachable and featured OOTB than vanilla Emacs.
For me, the benefit of Emacs is that it's a single environment I can do everything in. I also am the type to enjoy messing with my workflow.
IMO most of that can be replicated with VS Code in a much more user friendly manner (VS Code remote editing blows TRAMP out of the water), with the caveat that multiple projects means multiple windows, it's difficult to have an entirely mouseless workflow, and in general it's less customizable than Emacs.
I personally never bothered to learn Emacs keybindings and instead use Vim keybindings in every editor I touch; VS Code and Emacs both have excellent Vim plugins.
Honorable mention: Neovim. It is lighter weight than either Emacs or VS Code but can still have pretty much all the bells and whistles. Definitely cool if you prefer to live in a terminal.
One place emacs has a huge advantage is it doesn't use hardly any resources in the docker container.
The vscode remote server instance uses a constant 15%-30% however.
In real world terms this means a compile that takes 1 minute for me takes 2 minutes for my coworkers that use vs code.
There are many potential confounding factors that could affect the performance discrepancy of course, but I think it's still useful given I can't think of many other plaform differences and that it's consistent amongst my coworkers.
I'm surprised the difference is that much though!
I think it is not that black & white. Recently I've used tramp to dial into a server via SSH and there into a docker container and directly edit files inside. I don't think VSCode can do the same inside a shell it starts. Sure it may be able to open an SSH shell and then from there you might be able to type in some docker exec command. But that is not the same as tramp into docker container on a remote host via SSH for the following reasons:
When I use keyboard shortcuts from inside that tramp shell, Emacs understands, that it happens inside the tramp context and for example will only show me files inside that docker container, when I do a find-file. Should I decide to run an rgrep from that context, it will show me results in that context. If I click the findings of that rgrep, it will probably open the findings, which are on the remote host inside the docker container. If I open dired from the tramp context, I will see files from that context, not files on my own machine. Context is the magic here.
This level of integration is missing from VSCode. VSCode replicates part of these things, but things are not integrated. Want to ssh into a server? OK can do. Want to open files? OK here are your files from your own machine. It does not understand, that it should use the generic action of showing available files in the context of the opened SSH session. This might be a consequence of things being less coupled with keyboard workflow. When I use a mouse to click some menu items, it is not clear to VSCode in which opened tab/buffer that action should be performed. When I press a keyboard shortcut in Emacs, there will be a buffer (or mini buffer, or whatever) which has the focus and does not have to lose the focus, because I am not using the mouse to click outside of it. Things which are taken for granted in Emacs (all that integration and generic actions, which work anywhere) do not seem to exist in VSCode. Maybe most people are not even aware of how generic actions like opening a file could be integrated, because they have never seen it like it is in Emacs.
On the other hand, VSCode might have a more fluent experience for when you do not want to do anything more complex than SSH into a server and might be speedier at those simpler workflows. There are probably well paid engineers at MS, who try to make things run smoothly when the shell is an SSH session on a remote server. I have not benchmarked this. Just a guess.
Are you sure? If I launch a remote session window and click open file/folder, it's on the remote (either SSH or docker for my workflows).
VS Code runs a server on the remote with any plugins (including LSP servers) installed with it. This is as opposed to Emacs, which AFAIK does not have a server on the remote and instead interacts with the remote directly using SSH (or `docker exec`, etc). Note, you still need to have any LSP servers installed on the remote if you want that capability.
I would argue that VS Code's remote editing experience feels more integrated than Emacs with TRAMP; I've had issues before where something is more difficult to do over TRAMP than locally, but I've never had that with VS Code.
You're right though, "blows out of the water" is a stretch, I just have fights with TRAMP fresh in my head haha
In terms of making editing on a remote seem just like editing locally, both VS Code and TRAMP are capable, I just find VS Code remote editing to be much more user friendly. It just works with little to no configuration.
I am not sure about dedicated extra windows. I've not seen it being done in an ad-hoc started shell, inside a normal VSCode editor instance, at least. If it is a new windows (new process) it is not really the same, as the new instance is then dedicated to being a remote session one. With Emacs one does not have to start multiple instances to get things done, but does everything out of the same instance.
Whenever I see people closing and opening VSCode instances, I feel like: "Why did you close that?! Can't you just do things in your editor without frequently closing and opening it again?" It feels like an inefficient process. "I can't do it in this instance, I need to close it and open a new one from another working directory.". I can only speak from what I have observed people doing when screensharing. Maybe other people do it differently or more efficiently.
> VS Code runs a server on the remote with any plugins (including LSP servers) installed with it. This is as opposed to Emacs, which AFAIK does not have a server on the remote and instead interacts with the remote directly using SSH (or `docker exec`, etc). Note, you still need to have any LSP servers installed on the remote if you want that capability.
Emacs has had a server program since ages. You can run Emacs as a server, for example on a remote host, or on your local machine and when you start a GUI or non-GUI Emacs, start in client mode, to connect to the Emacs server. Your Emacs client will benefit from whatever you have set up the Emacs server to do. If your Emacs server has LSP stuff set up, you will be able to use it in your Emacs client.
For merely accessing a remote via SSH and accessing files in it, editing them and saving them, Emacs truly does not need any server. It channels anything one does through the SSH connection and "commits" to the remote's filesystem.
I agree though, sometimes tramp can be a hassle. It could be better and better documented as well.
I’ll have to try VSCode in this area, but Tramp seems pretty awesome to me so I’m trying to think how it could be blown out of the water.
There are several GUIs for Neovim for various platforms [1].
[1]: https://github.com/neovim/neovim/wiki/Related-projects#gui
I see that I'm missing something but I don't know where to start. Org-roam seems interesting.
Do you have any recommendation for how to use org-mode productively?
I have a treat for you!
Free video course:
https://m.youtube.com/playlist?list=PLVtKhBrRV_ZkPnBtt_TD1Cs...
Paid udemy course (improved?) version:
https://www.udemy.com/course/getting-yourself-organized-with...
Something different blending org-mode and org-roam:
https://d12frosted.io/posts/2020-06-23-task-management-with-...
If you want to go further, you can use things like including other org-mode documents at specific heading levels or even write thesis in it, falling back to latex when needed. There is also a citation format now in org-mode.
Another thing you could explore is org-babel. Try out the ideas of literate programming. A bit of "write once, export to other formats" like HTML make a blog post or similar.
I also use org-mode for some spreadsheet capabilities. Not really huge spreadsheets, but usable. For example I have working hours time tracking in org-mode using a table with formulas (a spreadsheet). Or I have a repository with recipes, where I can let it calculate amounts of ingredients, depending on the number of people who want to eat.
1. Learn org-agenda. And I do mean really learn it. I use a few of alphapapas amazing packages (org-super-agenda and org-ql). Learn the difference between just a TODO, scheduling, deadlining and tags. Don't overdo it on tags. Set up groups in the agenda for different things (STATE or TAGS, or something else)
2. Set up capture templates that fit you so you can instantly note things down in the right place
3. Learn org-attach so that you can have everything in your second brain
4. Do not fret to much about one large file or many small ones - use whatever you want. If you feel you want to change it, just change it. It is just plain text. This applies to everything in org-mode.
5. Learn org-store-link, which makes references to things like emails (even if they are moved/archived after the fact) or git or whatever to keep references.
I spent a lot of time getting this together myself. I empathise. But if I could not use org-agenda and the searches I have in the way I do, I would probably feel not get into org-mode either. Recall is key.
I do use org-journal [1], though, so I can ctrl-c ctrl-j to add a new entry, and have it automatically wired up for rotating the file monthly. I use this for adding new items and having speedy access. But that's it. I don't use Agenda or any of that fancy stuff, so don't feel guilty that you're missing out.
https://easyorgmode.com/blog/how-i-use-org-mode-to-keep-trac...
I don’t have a very rigid workflow with it. Typically one org file will be a project I’m working on. I use custom “TODO” tags to show the state of items. I also love the table functionality. It basically replaces spreadsheets for me and it lives with the rest of the text.
https://m.youtube.com/playlist?list=PLVtKhBrRV_ZkPnBtt_TD1Cs...
Modern conveniences include magit (the best git [porcelain] I’ve ever used) and cider, but I’ve been using emacs for 30+ years now and feel like for all but the first 6 months, it’s been an increasing time-saver and powerful lever for me to use.
BTW, the System Crafters Youtube channel has pretty good Emacs stuff - including for those with little experience. Although I've used Emacs for over a decade, I learned about fairly helpful packages via that channel.
But nowadays I tend to prefer technologies that work reasonably well with a set of sane defaults. Emacs works really well when you are working on really hard problems and programming fringe things from scratch, but it pales in comparison to the productivity of simple no code tools that's been flourishing recently.
That's the experience for the kind of work I've been doing recently, which are mostly CRUD apps to support a business. It might not be true in other domains.
People are always going to love it. But I think all the best ideas from that era have been taken.
I like Vim but EMacs won the editor wars
I don’t think EMacs or Vim will come back. They have revivals, I came in during one of those. This is definitely one of them.
It's hard to imagine a definition of "win" that goes from roughly 50% popularity to less than 5%.
The real split was whether people wanted an editor to work like an IDE or not. Everyone did. Even Vim.
I think it makes more sense they are there for those of us who know Vim but one day we’ll all die out
Emacs is a platform centered around text.
Eh.. Which every other editor would that be?
There is a mode [0] you can enable just because of how different it is to every other popular editor ever. Still.
What we want to do is list features. For example, people prefer the GUI and the mouse, non-modal, batteries included.
It’s not a bad thing. It’s just been a while. Those editors were written for a time that don’t exist anymore.
Imagine spending 8 hours a day for the rest of your life and you still want a cursor based popup telling you what you might or might not want to do instead of having muscle memory of what you do.
It took me a few tries too, back in the late noughties, before I finally found it "clicking" with me. I have a pretty good sense of what made that possible, but no idea if your experience is at all similar, so I hesitate to suggest anything in advance of getting a better sense of what I'm suggesting about.
I love Emacs for some of its really nice features that I just cannot find anywhere else (and no Elisp knowledge is required). I'm not one for tech monocultures and try to diversify my tooling as much as I can, but Emacs is seriously good when it comes to so many things:
- Magit in Emacs is arguably the best Git interface in the planet. You can run simple operations and complex workflows with just a few keypresses.
- Note-taking with org-roam (https://www.orgroam.com/). This is the best Free note-taking system that I know of — it's like Roam Research, where you can have your own zettlekasten with backlinks etc. and it scales really well with a very large number of notes (it uses a SQLite database in the background). Notes, articles with images, I use this for so many things every day.
- Encrypted notes. Emacs handles encryption elegantly out of the box. You can encrypt entire documents transparently (by adding a .gpg extension, for instance) using symmetric or asymmetric encryption, and Emacs will get your keys from gpg all automatically. You can also encrypt small sections inside a larger document.
- Spreadsheets. I do all my personal spreadsheets in Emacs' Org Mode. It never ceases to amaze me how text formats can be so powerful. Works even on my oldest computer running Emacs from a decade ago.
- Emacs Calculator. This is like a mini-WolframAlpha inside Emacs. I can solve equations, perform operations on dates, convert units, track returns on investments, simple and compound interest, the list goes on. And it integrates really well with the rest of Emacs as well.
- Org Mode. This is possibly the best designed markup language. I take all my notes in this. You can have inline images, spreadsheets, code blocks with inline execution etc. Its support for literate programming is really awesome: it's like Jupyter Notebooks but for any language. (Emacs' Markdown support is really awesome and powerful, as well, with its previews and table handling etc)
- Gorgeous typography. I run Emacs as a GUI app at all times, and it renders all my typography (proportional or monospaced) gorgeously which makes it a delight to look at and use (Ideal Sans + Verlag for notes (org, markdown, reST etc), Cascadia Code for coding with programming ligatures enabled). This is all in the raw text, not just in the preview like other editors.
- Powerful macro support.
A few other miscellaneous things that come to mind:
- Powerful window management. I can split panes vertically, horizontally, and undo and redo my window layout, all out of the box. This makes working with multiple files a breeze, especially when you have to look at some of them at the same time, and/or move to different layouts on the fly.
- Navigation and text-editing at a higher level of abstraction. With Emacs, I can navigate not just in the normal ways (by lines, characters, words etc.), but in various other context-dependent ways: e.g. Emacs understands sentences, functions etc. and I can navigate, delete, select, and manipulate text at a much higher level, allowing me to work with Emacs in ways that traditional editors cannot match.
- Calendar. I use this for various things, like quickly finding out when sunset is. It can also tell you phases of the moon etc. if you need that, all out of the box.
- Email using mu4e. Emacs can work as a beautiful mail client. I used to use this several years ago with mbsync (isync). It's surprising how offline email can let you search through all your emails literally instantly.
And there's so much more depending on what you're looking for :)
Emacs is like this retro piece of software that is paradoxically highly modern at the same time and actually better than the status quo. (It's snowing outside now. Let me go ahead and run M-x fireplace in my Emacs ;)