Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
An Interview with Mickey Petersen, Author of Mastering Emacs (syntopikon.substack.com)
159 points by cocacola1 on Nov 19, 2022 | hide | past | favorite | 42 comments


At the risk of gushing a bit about Emacs, I'm going to share just a few things that I have gotten out of Emacs that I don't believe I have gotten out of Vim or VS Code.

A minor thing, that perhaps betrays my lack of commitment to really devoting myself to Vim, but I find the keyboard macros in Emacs clicked for me, far more than the equivalent functionality in Vim. I've read arguments that the Vim functionality can actually be superior because it can be applied after the fact, but Emacs keyboard macros are what clicked for me.

And given easy keyboard macros, that can cross buffers (and therefore even embedded shell invocations) you can construct your own text based workflows that are more flexible and streamlined than anything you are going to find in another editor or IDE environment. And that is without even having to deal with Emacs Lisp.

I find the Emacs keyboard macros also get supercharged when you combine them with Evil (Vim emulation) mode. That ability to record and play back complicated multi-state evil commands is awesome.

I also credit Emacs for exposing my son to his first experience with hacking / looking at source code. I showed him the Adventure game (yes, Emacs ships with an embedded text adventure game). And then I showed him how to find the data structure that describes the maze in the game, and he used that graph to figure out how to navigate through the maze.

I could go on, but that's probably enough random thoughts for now.


What’s your favourite emacs workflow macro to date?


Honestly I don't usually have anything super impressive. It's just that they are so seamless to define and use.

Lately I've used them a lot to deal with buffer to repl interactions where there wasn't a working mode to load the buffer into the repl.

It's trivial to run a repl in a shell buffer and then create a macro and keybindings that will save the file, switch to the repl buffer, and then insert the command to reload the file (and/or restart the repl if necessary).

Probably now that Vim and NeoVim have useful integrated terminals I imagine they can probably be automated similarly, but I mostly use vim as my failsafe editor and try to keep my interactions with it pretty stock, so I don't really explore automating it heavily.

I've used Emacs keyboard macros frequently to automate org mode to make certain kinds of entries immediate (almost like using a snippet solution).

Keyboard macros are not the be all and end all. But they are really useful for chinking around the cracks between other tools. They are a quick tool for prototyping and scripting automation.

Sometime last year I was experimenting with my own plain text note system outside of org mode (I wanted something that was a little more robust for dealing with arbitrary copy and pasted text without it potentially triggering semantic interpretation of the buffer). Using keyboard macros allowed me to quickly work up commands to deal with the various parts of the file in an interactive development style - it made it very easy to experiment with what was effectively a new file format without any real parsing or coding. I would guess it wouldn't be robust for release, but for figuring out what made sense or what I wanted, it was super helpful to have that ability to define new text interactions quickly.


Nice interview. I have been using Emacs for about 40 years, and I am getting a lot out of Petersen's book. He recommends reading the Emacs Manual - I mostly did that decades ago, and forgot most of it.

Anyway, I recommend his book.


"He recommends reading the Emacs Manual" is basic and obvious that a lot of people miss it. I try to do it for all software that I use. I don't need to memorize it, but familiarity is helpful.

Even if I can't remember how to do X I know the piece of software I'm using can do X.


It’s very long and dry. I recommend balance it with installing some flashy packages like selectrum, company-mode, and eglot. The wonder created from using incredible packages helps fuel and direct the drudgery of learning the nitty gritty.


What helped you most getting up to speed in emacs? Every time I try I give up


Starting small.

I started with org mode and plain text files. Magit has been a very handy tool. I've started using it for markdown more recently.

Don't try to do everything. You'll get burnt out from learning/spending too much time customizing.


Ha. I feel the same about vi. I know enough to use it for basic edits if emacs isn't available, but I struggle with it.

In one of my first programming classes in school, the available editors were vi and emacs. The modal operation of vi kept throwing me, so I used emacs. Over 30 years later I have rarely used anything else. I had one job where Visual Studio was used. I tried using it with emacs keybindings, but eventually switched to using emacs in cygwin and only used VS to run builds.


I can completely relate to this.

What helped me the most was Ch 2 from "Clojure for the Brave and True" https://www.braveclojure.com/basic-emacs/

Basically how to open, save and basic editing. I knew it was going to be slow and mildly painful to learn but I wanted to learn Clojure (since moved on to Common Lisp).

I used Vim for several years and would still consider myself very novice. I don't dig into anything for the sack of digging. I learn just enough to do what I need to do. When I need something new then I look it up. Same thing with Emacs, I've been using it for 4 or 5 months. I enjoy it and it lets me work with Common Lisp so I'm happy.


In the early days, it was easy to install Emacs on any system I was working on.

In modern times, VSCode is a fine substitute for Emacs, so try that. I generally prefer Emacs because I am so used to it.


VS Code has many pleasant properties, but its lack of respect for user freedom is a real turn off. Also it is considerably less conveniently extensible than Emacs. That however is definitely a double edged sword and there are valid reasons to go with a less customizable tool.


I would guess there's about 1000x as many people who are capable with javascript as there are who are capable with elisp though.

... that could be a feature, depending on the person, I guess.


It’s not so much the particular extension language as it is the design philosophy. JavaScript is considerably lispier than most squiggly brace languages.


I find the Electron based GUI of VSC to be laggy compared to other GUI editors like Sublime Text.

It's subtle, but there is a noticeable lag when clicking on a file and the view refreshing in VSC that isnt there in Sublime Text, for instance.


I learned it by using it to do a project in college in Common Lisp using SLIME. There wasn’t really a good Lisp environment for the editor I was used to before that (visual studio) so o had to power through.


What happened when you gave up?

This question to me is like, how did you navigate this jungle? I got lost. Theres many answers depending.


Editing code is easy; there's myriad editors, including Emacs of course, that can do this. But there aren't many tools to track bibliography, your agenda, email, notes, and writing. But Emacs can easily do all of that, and much more.

There is a certain ilk that prefers to tinker with their tools, until they are just the right shape, versus those who learn to compensate for quirks in their tools. Emacs is definitely quirky, but its strength is it handling your manic desire for total workflow integration.


I went through Mastering Emacs before actually jumping ship from Vim to Emacs. Glad I did!

After more than 25 years of Vim, in the last month I've completely switched to Emacs. And it feels like a super power... I'll be using it for the next 25 years and beyond!


Enjoy the new environment.

I used to be a “competent” vi user, laughing at the Emacs vs vi jokes, until I realized I didn’t really know Emacs. I gave myself a 4-week challenge where I’d use nothing but Emacs, for the challenge, and to learn. Fast forward 5-6 years later, still an Emacs user, I wondered if I could understand vi as well as I’d come to know Emacs. I gave myself a challenge, …

Have since done the same w ex(1), but I didn’t let it stick for many years as a daily-driver.

I’d recommend the challenge to anybody. I did the transition doing “production work”, so it’s possible - you may not have to “wait for the right time.”

Enjoy your editing in good health.


I'm a https://www.spacemacs.org/ devotee. I love the Vim commands, but physically cannot take more than light interaction with the Emacs default key bindings.

How sweet it is to completely reconfigure the environment without losing magit and org-mode.


I am (was, will be again?) an emacs user, recently switched to neovim from emacs. Very happy so far with speed, plugins and workflow.

Also: esthetics. Modern neovim with telescope is imo just more pleasant to look at. (I was using doom emacs in the past). There are nano themes from rougier for emacs however, never gave them a try.


As another longterm Vim user, this really piques my interest.

What would you say are the main things that you like about Emacs over Vim?


It's perspective I guess...

Vim is a text editor, whereas Emacs really is by definition just an Elisp runtime. Every time you type, you're calling the Elisp functions that are bound to those keys - this makes customisation simple - don't like it, you're free to change it to call different Elisp funcions.

And once you get the hang of it, it's so simple to make bindings to do ANYTHING you want (i.e your key bindings just do whatever you want them to do!).

So, out of the box, Emacs is a nice editor and some people have made default bindings... then you customise Emacs to be YOUR Emacs. In other words, Emacs is just a library for text editing and other utilities and you put them all together to make your own editor. Thinking this way, Emacs really isn't an editor at all, it's really a framework to create your own editor!


Why, what's so good about it?


See my reply to another comment above.


The closest I ever got with vim is with this game: https://vim-adventures.com/ How different is Vim and Emacs' user experience? Would the vim-adventures also apply to emacs?


I don't think there's anything like that for Emacs. At least, I've not heard of it. I mostly learned it through reading stuff like Mastering Emacs and watching YouTube videos, as well as testing out other peoples configs.

UX wise, it's pretty different but I know a lot of people use Evil (https://github.com/emacs-evil/evil) or something similar to get a more vi like experience out of Emacs. If you're not vested in an Emacs workflow, or don't have one at all, I think it's worth checking out other peoples configs.

The biggest benefit of Emacs is that you can do some much from one place. That's much less context switching that you have to do, and I can see why some people prefer it.


I used vi mostly when working from dumb terminals from where i would telent to a machine. There was a lag when you did stuff and the modal editing style was perfect for that. You'd type a few commands, they'd get sent to the server and the screen would refresh. It worked nicely.

I moved to Emacs mostly, iirc, to get gud and then stayed on it. Still use it heavily. Org mode has been a killer application.


I've spent a lot of time with Vim and Emacs (with both the default Emacs keybindings and using Evil).

I haven't made it through all of vim adventures, but based on what I have done, I think that a significant portion of what you would get out of vim adventures would transfer to Emacs using Evil mode (or derivatives like spacemacs or doom Emacs).


No.

Vim is a text editor.

Emacs is a lisp interpreter whose dialect of lisp is specialized for text manipulation. In emacs the user interface is incidental to the main goal of programmatic text manipulation.

In vim the user interface is the be all and end all. Which is why vim is now a specialized emacs mode when you need character based text manipulation.


Vim has its own script and vim can have its lisp mode. emacs never got it too many 3 keys ops. Vi (I started from ICL … is always I can associate with. Hence different poison.

Btw If you try to learn emacs in iphone or ipad, iSH and a-shell both give you an escape key and control-key. Hence no emacs default key mode. Guess I can try boon or evil. But you know just 3 keys or basically 4 is not that user-friendly for newbie.


>Btw If you try to learn emacs in iphone or ipad...

...you're going to have a bad time.

Emacs is not the hammer that wants to hit a touchscreen interface nail.


Just buy a keyboard ffs.


If you use Emacs in Vim mode -- I'm not much of an Emacs user in general, but lately I've actually tentatively taken to Doom Emacs, much to my own surprise -- is Mastering Emacs still useful?


TLDR yes. My current config is vanilla emacs, it’s very minimal. It uses boon for modal editing. I’ve delved into the boon elisp code enough to patch it so that it has a somewhat functional way to switch between Dvorak modal editing and Qwerty.

I’ve read some of Mickeys blog posts, not the book. I can generally recommend learning how to emacs and I’m sure mickey will help you a lot to do that.

I used vim for 5ish years. I switched to emacs with its C-p C-n etc for a while. Then I found found boon, then I made my patch to it. vim to me is now subsumed by a <1000 line hackable elisp file.

The whole process of installing the boon code, searching and navigating it, making changes and dynamically reloading it, and then using it, etc. You can take it one step at a time and everything is ready for you to take the next step.

In vim, it works the way it works and you can learn it and use it. In emacs, same, and if you want you can also easily browse it’s code and dynamically change it. It’s strictly better. Zen and the art of motorcycle maintenance

I also find that browsing the source is so easy that documentation is more annoying to use. Sometimes I find documented customization options that are the little hack i would have made in the code anyways.

It’s not everybody’s cup of tea, but it is truly a cup of tea.


Miss that. And might try it next round. Love the zen and the motorcycle book.


>I'm a writer and I'm really good at punctuation and spelling, do I really need to learn how to write a good story?

Vim is a text editor, emacs is a text manipulator. If you never want to do more than copy a rectangle of text from region a to region b then you don't need more than vim. If you want to write tools that fit your workflow you need to know elisp.


For readers, don't think this means you need to be an elisp hacker to benefit from emacs. You don't need to write tools -- there are hundreds already written, and installable as packages. I use emacs to edit code, organize projects, and read my email but I rarely touch elisp.


To anyone reading: don't just be a consumer. There are enough projects made for people who just consume. Emacs is still a project run for people who make stuff with it. Please go somewhere else if you have no interest in building anything.


Imo, no harm in being a consumer. I think every hacker is at some level a consumer. But you will get the most out of emacs if you have a habit of becoming less of a consumer.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: