Live data from Hacker News

Absolute Beginner's Guide to Emacs (2012)

jesshamrick.com

171–180 of 262 posts

Re: Absolute Beginner's Guide to Emacs (2012)

#171
post #119

You should check out tramp-mode too. Its a killer feature that lets you edit files remotely (AWS, Azure, even docker containers!) as if they are local. All the stuff work, so you can do diffs between a local file and an a AWS file and it all appears to be local. If you are editing a remote file and do a git action (through magit) it knows to work on the remote file. You can open up remote shells also. You just go: CT…

I used it on Windows to edit files on a RHEL machine.

It worked okay, only issue i had is that periodic autosave makes the whole emacs freeze due to network round-trip. Disabling/toggling autosave or lenthening the autosave timeout solved solves the issue.

BTW, tramp is really awesome. One of those pearls within GNU Emacs.

Re: Absolute Beginner's Guide to Emacs (2012)

#172

Earlier quoted context omitted.

Not funny. Evil mode was released in 2013.

I tried Evil mode a few months ago and went back to Vim very quickly. It's one of the best Vim plugins out there, but it still misses a few features and it also behaves differently in a couple of situations. It never really feels like Vim, more like a minefield of unknown shortcuts with a layer of Vim bindings on top. But I get why some people like it, if you can't stand modal editing then Emacs is a great choice.

One of the selling points of neovim was to make it more easily embedded into other programs.. doesn’t seem like anyones trying to do so from a quick googling though; maybe one day there can be true unification of the holy editors

Re: Absolute Beginner's Guide to Emacs (2012)

#173
post #122

Another subtle but important use of emacs : it is a good playground for (a flavor of) Lisp. Together with the source code galore in site-lisp/, it is a really good environment to learn how a full-blown system can be put together in Lisp. [Hooks, macros, advice - all the goodies to shoot yourself in the foot in that wonderful Lisp way!] Also relevant is the great article by Stallman on the exact C-vs-Lisp division of…

Thanks for the first article. “Multics Emacs proved to be a great success — programming new editing commands was so convenient that even the secretaries in his office started learning how to use it.” This reminds me of a story I heard that early on at Amazon supposedly the company used applications built onto Emacs instead of building in-house web applications for internal use. I had a chance to talk with an early em…

You are likely thinking of this Steve Yegge essay:

https://sites.google.com/site/steveyegge2/tour-de-babel

Search for "Then you know Mailman", and you'll find the bit I'm thinking of.

It doesn't say they built multiple systems around Emacs, but it does say Mailman was built in Emacs Lisp, and that they had people writing Emacs extensions to further Mailman's functionality.

(And that their non-technical customer service folks loved Mailman.)

Edit: found more-canonical URL.

Re: Absolute Beginner's Guide to Emacs (2012)

#174
I was just reading the New Yorker article about the partnership between Jeffrey Dean and Sanjay Ghemawat at Google [0]. I noticed this about Ghemawat's setup: "There were four windows open: on the left, a Web browser and a terminal, for running analysis tools; on the right, two documents in the text editor Emacs, one a combination to-do list and notebook, the other filled with colorful code." (Emphasis added.)

I'm guessing the "combination to-do list and notebook" might have been org-mode?

[0] https://news.ycombinator.com/item?id=18588697

Re: Absolute Beginner's Guide to Emacs (2012)

#175
post #166

Earlier quoted context omitted.

You can't tell me why you need it.

I can. I just did, in my original comment. People's brains work in different ways.

But your eyes don't. You do not need it to be there at all times. But you'll refuse to try anything else and see that I'm right.

Emacs can do whatever you want but almost every single user switches off the permanent tabs, buttons, scroll bars etc. as soon as they realise they can because it is unnecessary.

Re: Absolute Beginner's Guide to Emacs (2012)

#176
post #42

I tried Emacs several time. The concept is cool but the execution makes it so that for me, in practice, VS Code is better. I'd want either: * tabs with a good UX or * super powerful, easy to use, integrated command and fuzzy file search, also with a good UX. I'd also want a terminal at least as good as the VS Code one, on Windows, to use with Cygwin. With Emacs I'd have to learn a big bunch of terminology no other ed…

I've heard developers say this before, they want tab bars or good fuzzy search. The puzzling thing is, I feel almost exactly the opposite. I've used many other development environments (over the last 50 years), some for years at a time and others on off for many years: Intellij, Xcode, Adobe products, Textmate, Vim, etc.

These other IDEs and editors certainly have their own strengths and are in some ways better than Emacs for some tasks, but for navigating between tasks, projects, and recently used files Emacs is the best tool I've ever used.

To visit a file, whether for the very first time or to just get back to the previous one you were using, the find-file command is Ctrl-X Ctrl-F. This does exactly what I want about 90% of the time. I type a few letters and because of completion I get to what I want in an instant. This command is one of the first ones that beginners need to learn to open a file for editing. It's trivial to rebind the visit-file command to any key you like (Spacemacs uses Space-F-F). You might be thinking, "Oh yeah, but sometimes I want to open a file read-only", well there's a command for that too its find-file-read-only, bound to Ctrl-X Ctrl-R. Or maybe you're thinking, "What will I do when I want to insert the contents of a file at the cursor?" maybe Emacs won't work for me since I do that a lot. The good news is: there's a command for that. You might be thinking "Thats swell, but sometimes I need to see the file contents in hex!", well there are commands for that too.

On my system there are almost 500 available Emacs functions containing the word file. I was able to find that out with the built-in documentation that gives me access to descriptions of all these functions and key bindings in just a couple of keystrokes (C-h starts the best built in help system I've ever used, period. You can even jump into the code that implements all of these functions.) I recommend sticking with the simple find-file command for a week or two before delving into the many fascinating options available for the Emacs hacker.

If you want to actually see the files that you have already been editing, Ctrl-X Ctrl-B lists the buffers in use. This is a bit like looking through tabs, but Emacs manages hundreds of simultaneous buffers at once and some users like using the buffer list to see all of the current work across many tasks that have been going on over a period of weeks. You can navigate rapidly though the buffer list and pick a buffer to be displayed in your current window pane or other panes or windows. Jumping between buffers, windows, panes within windows is all done with a couple of keystrokes so its fast and easy. If you know the name of the file/buffer already you can use Ctrl-X B, the switch-buffer command to open it directly without browsing the buffer list.

Maybe it's not a current file you want and maybe you don't remember the name but you do know where it is located. The amazing dired interface displays directories and makes it easy to list, rename, or edit (or copy or change permissions, etc.) the files within a directory or it's parent directories or children. Again the interface is right from the keyboard so it is very fast and easy. Dired opens automatically when you do find-file on a directory name. Sensible name completion and shell like navigation make it easy to get places in the file system or remote file systems though the magic of Emacs ability to treat file systems on remote machines like local files if the user has ssh access. Dired is great, there is nothing like it and its various extensions provided by the Emacs built in package system.

These simple to use commands and a couple of commands for splitting windows into panes and jumping between them will get you a long ways and in no time you will discover that you don't miss tabs anymore. I really appreciate the extra screen real estate I have because I don't need tabs or tool-bars in Emacs. I can easily see three or four files at once since the navigation buffers for dired and buffer lists open only when needed.

I know, you're maybe wondering if a form of Emacs Stockholm Syndrome has me under it's spell: windows, panes, buffers, files--it just sounds confusing. Yes, tabs are a simpler idea. Emacs has been around so long that its nomenclature is a bit archaic. What a normal developer would call a window is a "frame" in emacs. I usually like to have a single large frame while I'm using emacs, but you can open up a multiple Emacs Frames, say on different displays, and hop between them with a keystroke or two. Sometimes that's helpful.

Inside a Emacs Frame you can have multiple re-sizable horizontal and/or vertical splits that give you a number of separate panes for editing in. I usually have two or three while I'm working. They work great and are easy to use with a few of the built in commands. The biggest problem is that Emacs documentation calls them "windows". So in Emacs terminology a Frame contains Windows (in modern terminology we would say the Emacs windows can be divided into panes or regions).

A Buffer is just an editing session (usually, although documentation and system information is also held in buffers). The buffer has a cursor and some other features and is usually associated with some underlying file, but the buffer can be written to a different file (kind of like Save-As) and now it becomes associated with the new file name. Multiple buffers can be opened against the same file providing different views of the the file and they can have different cursor positions and different editing modes. Is a buffer also an Emacs Window or Emacs Frame? Buffers exist independently of the user interface to the buffer. When you open a file in a new buffer or switch to an existing buffer for a file, the buffer is presented for editing in one of the Emacs Windows in one of the Frames. The default is the current Frame in use. This makes switching to a buffer like clicking on a tab. But the architecture is more flexible.

The commands I've mentioned work in default Emacs right out the box. More experienced users like some of the fancy searching and auto-completion packages like helm or ivy. There are also speedbars for those that like to mouse-click on a project directory outlines and sophisticated project management tools like projectile with fuzzy searching across the files withing the project. These add on packages are so easy to add that the real problem is having too many features available.

I should mention that there are many fancy fuzzy search tools, but I really don't use them myself, I get by with the basic functions provided by Emacs for grep'ing and searching. And if you still want tab bars there's a package for that, tabbar mode.

Related to project management and along with org-mode one of the most recommended Emacs packages, magit, a really great interface to git that is very well integrated with Emacs.

Re: Absolute Beginner's Guide to Emacs (2012)

#177
post #154

Earlier quoted context omitted.

It feels like Emacs Developers are actively tries to shoo away modernization and people who do not want to put in hours trying to actively learn just Emacs. At one point I tried using Emacs for everything but it didn't work out for me. Now I still use it but only for tasks management and coding. Unless you want to spend hours of your time customizing it and then a lot of other person also does the same customization.…

Well the problem is that people caring about Emacs have learned a long time ago what a kill-ring, the point, the cursor and meta mean in the context of Emacs. In its defence, a lot of that predates modern user interface conventions. Changing this lingo would probably make it more approachable for newcomers but it would confuse experienced users. On top of that you can be sure that not all elisp out there will be upda…

> Well the problem is that people caring about Emacs have learned a long time ago what a kill-ring, the point, the cursor and meta mean in the context of Emacs.

Those people are not going to live forever so if Emacs wants to have fresh blood inducted then a gradual modernization would not hurt. I think even Richard Stallman agrees[1] to some of it.

> Beyond that Emacs's docs are unparalleled in the editor world as far as I know, ....

I agree Emacs have documentation for almost everything but I disagree on the quality of documentation. For example when I pull out a documentation Most of the documentation describes what the argument should be which is anyways clear by looking at the argument list. It would be much better to include an example instead of describing the arguments verbatim.

[1] https://lists.gnu.org/archive/html/emacs-devel/2014-01/msg00...

Re: Absolute Beginner's Guide to Emacs (2012)

#178
post #21

Earlier quoted context omitted.

> it's probably around thousand times more optimized than Visual Studio Code I am not saying that VS Code is everyone's answer and choice but VS Code is resource friendly enough. Who cares about the resource difference between EMACS and VS Code in real world practicality? I know people love to bash anything electron but it really isn't anything to worry about when programing with anything that is 6 years old or newer…

> Who cares about the resource difference between EMACS and VS Code in real world practicality? I literally use different apps on battery vs wall power: wall: Firefox, Slack, VSCode battery: Safari, mail, Emacs The difference is clear as night & day. Mac OS X has a tab in Activity Monitor where you can observe energy impact of different apps, and it consistently reports Electron apps as... psychotic. An order of magn…

But what real world difference besides some battery improvements. They are both fast in terms of responsiveness and I find VS Code to be much easier to customize and get up and running.

Re: Absolute Beginner's Guide to Emacs (2012)

#179
post #142
post #119

You should check out tramp-mode too. Its a killer feature that lets you edit files remotely (AWS, Azure, even docker containers!) as if they are local. All the stuff work, so you can do diffs between a local file and an a AWS file and it all appears to be local. If you are editing a remote file and do a git action (through magit) it knows to work on the remote file. You can open up remote shells also. You just go: CT…

M-x compile (and related) works too.

I use this all the time.

- edit over tramp - dired over tramp - magit over tramp - build over tramp

Just Beautiful.

Re: Absolute Beginner's Guide to Emacs (2012)

#180
post #150

Earlier quoted context omitted.

Why should I switch to new IDEs every few years? Meanwhile I've had emacs configs fail in subtle and not-so-subtle unpredictable ways with every system or emacs, or mode, or... update

Well, in the past I have used Eclipse, Netbeans, SunStudio (essentially netbeans), IntelliJIdea, Oracle JDeveloper and others: all of them are enormously bugged, perhaps Netbans/Sunstudio was the least bugged. All of them suffer from an ever grown dotdirs that sooner or later brake and you need to restart from scratch... In Emacs I have had brackeage, and an emacs bankruptcy. But in all case I have recovered anything…

Exactly. If all those IDEs in the IDE graveyard were so good, why are they dead, while your Emacs is still here?

Too tied to a platform or language, perhaps, and very specific processes related to these? No vision for extensibility or future maintenance?

Sometimes IDEs are very tied to specific target platforms: like IDEs from microcontroller and DSP vendors and such. E.g. if you're programming PICs, you use Microchip's IDE. It provides the image downloading to the target and breakpoint debugging.

Post reply on HN