UP | HOME

Trying the Atom text editor

From time to time I'm checking out the software (and languages) that I don't expect to like – just to not miss something actually nice because of the habits. Today I'm going to try the atom text editor, since it seems to use a relatively common nowadays approach, where a web browser is used as a GUI toolkit. I dislike "modern" web browsers, and most of the related technologies, but maybe it'll be okay (or even good). So, here we go.

1 Installation

It's not in CentOS repositories, of course, and building from source currently requires Node.js 4.x or above. I only have 0.10.42 from CentOS repositories.

Okay, let's see if it has CentOS packages or instructions. Indeed it does, but they suggest to use dnf on CentOS (CentOS currently uses yum, and RPMs tend to be Fedora-oriented anyway, meaning that they'll depend on packages not present on CentOS – so it's usually easier to go straight to sources). Then it links the node.js website, which suggests to curl things right into bash as root. Normally I'd just stop there, but since it's a day when I'm going to try new things, going further.

I'm not adding much of custom repositories, for they tend to screw systems up, so let's see how to build node.js from source. There's a page with downloads for version 4.4.7, no dependencies listed around, so let's hope it doesn't have much. The configure script is not made by autotools, it's in Python (yay, will catch another technology I had unpleasant experiences with – and hopefully it'll work this time).

Waiting while it builds, there are occasional warnings when compiling V8 (a Google Chrome JS engine). Takes a while to compile it all, so it's better to take a break here. OK, it's done, and apparently there is an uninstall target in the Makefile (which also uses Python for everything), so let's try make install, and then get back to atom.

Clonning the atom repository (wait, how did they get that name?) also takes a while, so let's read its description meantime:

Atom is a text editor that's modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file.

I'd normally read it as:

Atom is a text editor that uses technologies and approaches everyone will forget or be sick of in a few years, it's designed and only usable for newbies who see a computer for the first time and never learn, but at least it's customizable and has sane (FSVO) defaults.

But today, let's assume that it's indeed all it says, and try to get excited. Furthermore, "full-featured, right out of the box", a bunch of characters I don't have in the font (they encode pictures into fonts, apparently), and it's finally clonned, so back to building.

It uses a custom build script, this time in JS. Well, maybe it's grunt-generated or something, so that's one more seemingly terrible thing I'll try today. Not that bad if it works though.

Ah, here it goes:

[defanor@dws atom]$ script/build 
Node: v4.4.7
npm: v2.15.8
Installing build modules...
npm ERR! Linux 3.10.0-327.22.2.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "--userconfig=/home/defanor/Downloads/atom/build/.npmrc" "install" "--loglevel" "error"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! path /home/defanor/.atom/.npm/registry.npmjs.org/grunt-babel/.cache.json.1571143647
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall lstat

npm ERR! enoent ENOENT: no such file or directory, lstat '/home/defanor/.atom/.npm/registry.npmjs.org/grunt-babel/.cache.json.1571143647'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/defanor/Downloads/atom/build/npm-debug.log

Actually, it also requires npm v3.10.5 or above – strange that it didn't complain right after printing the npm version, and then suggested that it's "most likely not a problem with npm itself". Well, let's try to install a newer npm version. "Build amazing things", "npm powers the enterprise", "Harness the power of npm inside large teams", "Choose your npm adventure", pricing… Where are the sources? I've got it somewhere in the past, so they should exist, even despite all the terrible marketing slogans. Ah, apparently npm install -g npm should do that. A few errors of this type:

npm WARN unmet dependency /lib/node_modules/block-stream requires inherits@'~2.0.0' but will load
npm WARN unmet dependency undefined,
npm WARN unmet dependency which is version undefined

Though it seems that npm should be installed with node.js: maybe the previous installation screwed it. Indeed, /usr/local/bin/npm is a link to /usr/lib/node_modules/npm/bin/npm-cli.js, which was changed a while ago (when I've installed node.js from repositories), while there's /usr/local/lib/node_modules/npm/bin/npm-cli.js that was changed today. Let's fix it manually:

sudo ln -fs /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

Nope, npm --version still says 2.15.8, even when invoking from that /usr/local path explicitly. Let's just remove the old installation, then – though I contribute to a project that uses it, but hopefully it'll work with the new version as well: yum remove nodejs. Huh, a bunch of errors on removal – some files are missing.

Done, and npm --version still says "2.15.8". Poking it a bit fixes the issue somehow:

$ npm --version
2.15.8
$ sudo npm install -g npm
[sudo] password for defanor: 
sudo: npm: command not found
$ npm --version
2.15.8
$ sudo /usr/local/bin/npm install -g npm
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@3.10.5 /usr/local/lib/node_modules/npm
$ sudo /usr/local/bin/npm --version
/usr/bin/env: node: No such file or directory
$ /usr/local/bin/npm --version
3.10.5
$ node --version
v4.4.7
$ npm --version
3.10.5

Let's try to build atom once again. Now it sees the correct npm version, and managed to install "build modules" in 2+ minutes; installs some "apm" thing now, and I guess it'll take a while, too – so this might be a good time for another break. Though apparently it doesn't check the dependencies in the beginning, and could still fail in the middle of the process, but just sitting and watching it is not fun. Though I'm checking it quite often, what makes it hard to do other things.

It's finally "Done, without errors", let's try to install… sudo script/grunt install fails to find node, sudo PATH=/usr/local/bin/:$PATH script/grunt install works. atom-beta starts it, disconnecting from a tty (where I've tried to run it from, to see the possible warnings/errors) at once.

The installation alone took 1.5-2 hours, but it's done now – let's see what we've got.

2 Initial poking

The "welcome" screen features links to docs, to a forum, and things like "open a project", "install a package", "choose a theme", "customize the styling", "hack on the init script", "add a snippet", "learn some shortcuts". The initial theme is fine.

Let's just go through all the "welcome guide" things, since it suggests to "Get to know Atom!" right there. Apparently it's all very mouse-oriented, at least until you'll learn shortcuts.

3 Opening a project

So, I've tried to open a Haskell program, but wasn't able to select any of the files. Then I went to Scheme, and still wasn't able to. Probably I should install the corresponding packages first, which are right in the next section – and hopefully there's some other way to open the files that are not supported, just as plain text.

There's plenty of packages, let's try "language-haskell". The buttons have clouds and arrows on them, meaning that you get packages from a "cloud", what probably suggests that github uses a "pay-as-you-go" model. Good to know.

Nope, still can't open the files, but can just open the whole directory (it's called a "folder" in atom, apparently following the desktop metaphor to make it accessible for new computer users who are old now, and incapable of comprehending those computer things). I've accidently opened a wrong directory at first, and now it's not clear how to close it, but it opens new projects in a new window – quite unexpected, since it seems to have very rich UI. Perhaps it's a window per "project".

Opened the directory in a new window, got an error:

Unable to watch path: config.cson. Make sure you have permissions to /home/defanor/.atom/config.cson. On linux there are currently problems with watch sizes. See this document for more info.

Okay, sudo sysctl fs.inotify.max_user_watches=32768, close, reopen, no error. The colors are not so nice when there's highlighting, but it's there at least. At this point it's like notepad with colors and auto-completion, rather painful to use without shortcuts, so let's see what they are.

4 Using shortcuts

C-P (control+shift+p) is the only shortcut listed on the "welcome" screen, and it runs some kind of an apropos, with about a half of the commands having shortcuts defined. Looks like it's inspired by web browsers, where "close tab" means "close file". You open it in one window, for some reason it opens a tab in another one. There's also a "fuzzy finder", similar to ido in emacs.

Apparently the default way to quit things like fuzzy finder or apropos is using the escape key, which is not handy at all if you're touch typing. But then again, apparently the touch typing users are not its primary intended user base.

Though the apropos thing is quite nice, apparently word order is important there, making it not that easy to guess a name. It also seems that there's no built-in documentation, or it's well-hidden.

Maybe customization will help to make it more usable?

5 Customizing

5.1 Themes

After passing a few quirks, one can indeed set a nice theme.

5.2 Keybindings

When trying to set keybindings, it says "<question mark in a circle> You can override these keybindings by copying <a strange icon> and pasting them into your keymap file". Let's try it: copying alt-d editor:delete-to-end-of-word Core atom-text-editor, changing alt-d to alt-a (with no purpose other than to check), saving the file, guessing that some of those file watches are used to handle the settings… Nope.

Found something like "window reload" using apropos, it reloaded another window once again (the other one this time – I have no idea what's the deal with it) got one more error:

Failed to load /home/defanor/.atom/keymap.cson
[stdin]:1:28: error: unexpected of
alt-a	editor:delete-to-end-of-word	Core	atom-text-editor
     	                     ^^

Now, I'm not quite honest here: I didn't actually think that it'd work that way. Not sure why, it just didn't feel like it would: they probably make some assumptions about copying that don't hold with mouse selection. Let's see how it'll be copied with C-c… Ah, wait, there's that icon to the left of the keybindings – that's how you copy things! And getting the following:

'atom-text-editor':
  'alt-d': 'editor:delete-to-end-of-word'

Now reloading the window once again… And it reloaded the current window, not the one it reloaded the last time. I'd just close the other window if I knew how to open a project in the current one. Maybe it rotates them? Let's try again… Nope, the same window this time. But it worked to reload from the other window.

Quite annoying that the apropos doesn't show command history when pressing arrow keys. And I forgot to actually adjust the key with all that, so adjusting and reloading again.

It worked.

Even apart from all those quirks, it's not nice that it requires reloading to apply changes: that's not what I'd expect from a "hackable" editor written in a dynamically typed language.

5.3 Core

There's a "core" section in "settings", maybe we'll see what "hackable to the core" means now… Nope, there's just a dozen of settings, mostly checkboxes, like "audio beep" and "close empty windows". Though I think it is actually hackable, just not there: there should be a JS API somewhere.

5.4 Init script

Maybe this would suggest how to extend it:

The init script is a bit of JavaScript or CoffeeScript run at startup. You can use it to quickly change the behaviour of Atom.

Open your Init Script

Uncomment some of the examples or try out your own.

OK, opening init.coffee, trying to drag-n-drop it into a more suitable position with a mouse, it vanishes. Screw it, will just resize. Oh, and it's empty – there's nothing to uncomment, and no docs around. There were some docs linked from the "welcome" screen, let's get back to those.

6 Docs

They are not around anymore, can't find the link. Let's try to restart it, also getting rid of that opened directory in the main window… Ah, it stores the state, so no luck there (but it's still possible to just open a new window, close the old one, and then the new one – so only the new one will get restored after restart). Now "Welcome: Show" opens two panes, one of which contains that link, yay. It opens Atom Documentation in a web browser, which links the API reference and the Atom Flight Manual. The flight manual mentions the Atom goal of being great for everyone, and praises current web technologies – what is strange to read in a web browser that is configured to cut many of them. But let's pretend that it's different, the web is nice, and I'll even open it in a clean web browser profile to get the atmosphere right. Not nice for eyes, but tolerable.

6.1 Controls

That's where you finally learn shortcuts. They are terrible: arrow keys and such, mostly like in notepad/gedit/etc; very irritating if you're used to keep your fingers on the home row. Other controls involve mouse, getting your fingers even further from the home row.

6.2 Hacking

JS (or, rather, CoffeeScript) and CSS (or, rather, Less) are used; it's object-oriented and unpleasant.

Packaging involves a whole bunch of directories, what may remind of web frameworks or "enterprise" software.

Apparently there's no REPL, or it's also well-hidden. After writing this, I've been told that there's a debugger like that in web browsers, which one may call with C-I, and there's a "web console" in it, which roughly can be called a REPL. Themes don't seem to apply to it, it's all mouse-based, and pretty much what you see in a regular web browser. There's a couple of warnings, too.

7 CoffeeScript

"CoffeeScript is a programming language that transcompiles to JavaScript": it's strange how common the "trans[com]pile" term is in JS community: I guess it's to get away from the JS reputation of being a terrible language that requires a compilation from other languages to be tolerable, while only being used because web is historically stuck with it. And "transcompiler" underlines that it's compilation from code in a readable language, into code in another readable language.

It's basically JS with syntactic sugar: it adds to brivety, but doesn't make it particularly nice still – and, well, the syntax alone can't change much anyway.

8 Using git

If atom has one thing done right, it should be git integration. But I haven't found a way to e.g. check git history with it, without opening a github repository (in a web browser).

9 Big files

A 16-megabyte text file makes it to crash. What a shame for a text editor.

10 Resource consumption

Apparently, and as expected, it consumes more RAM than a customized emacs, though the comparison is very rough – I didn't really try to benchmark it, since a fair comparison would probably involve customization to get a similar behaviour, what would take much more time, which I'm not willing to spend on it: I'm already poking it for 5 hours now, could have done something useful instead.

11 Conclusion

Putting it all together:

  • Installation: terrible
  • Default controls: painful, mouse-oriented
  • Stability: crashed on the first day
  • Extensibility: CoffeeScript and CSS, OO API, no usable REPL (not by default, at least), ugh
  • Learning: not that easy, from external resources
  • Documentation: placed online, not handy to browse
  • UI: mostly unpleasant
  • Resource consumption: relatively high, but tolerable
  • Color themes: nice, even the default one is okay
  • Packages: plenty, though not sure about quality

I expected it to be slow, and heard that it is, but didn't notice that myself – maybe because didn't try to actually use it for anything meaningful. All in all, it's very far from usable for me, but I've used even worse editors about 10 years ago – so it's not hard to understand how it may be nice for newbies.

Perhaps the only thing I've liked is that interactive "apropos", which I'd like to have in emacs now. There is helm-apropos, but it's not quite that. A couple of weeks later, I wrote ftmx to get that in emacs. Though apparently it'll be abandonware: in emacs 25, it'd be better to add something like xapian bindings using those new C modules, but I'm too lazy for that.