Tuesday, October 14, 2014

Advice to Aquamacsen

I have had to give up on Emacs in OS X (Mountain Lion), which has been crashing all the time, way too much, almost every hour, unclear why. I tried the nightly, since the download here is sort of old. Then I littered up my Mac with Homebrew, and that version was no better. So I took the advice of somebody on the net and I went back to Aquamacs. After setting it up, I abused it all day, and so far no crashes. This blog post is for the few who are between the rock and the hard place, who love to write with Emacs as much as they love their Macs. My Macbook is to me a sickness like heroin addiction. There are the fonts, the colors, subtleties in the OS that you almost don't notice, but the latest versions have not been stable with Emacs the way anyone would like. Instead of looking for love and beauty in the real world I am holed up like a rat in a closet with my Mac writing about anything I can think of to write about, doesn't matter what. This is how I set up Aquamacs.

October 14, 2014

If you have a little bit of experience with Emacs, though you are not a programmer, you will notice that Aquamacs seems uninterested in dot files. I don't think they are "deprecated" exactly, it's just that you don't have to use them. This is a good thing you should take advantage of because finder is uncooperative with dot files, a real problem at times to non-programmers who are unversed in the rituals of the terminal. Of course, if you are a non-programmer who has ruined her life by obsessing over configuration files, try *NIX and give up on Mac. Your Mac will limp along on something else. Some say Slackware, others Fedora. In so doing you leave behind Apple fonts and colors. When I switch over to Ubuntu, which runs on my desktop, although fonts and colors are much better in Linux than they used to be, the general washed out appearance drains all the blood out of my forehead. Back I go to suck on the nipple of my crashing Mac. And in my case Aquamacs instead of Emacs. (I haven't saved for awhile, and I just had a terrible thought that Aquamacs was about to crash on me.) It is a sickness. Emacs never crashes in Ubuntu. Not once in an entire year.

Since the Aquamacs experts have decided to make it possible to run Aquamacs without dot files you can do everything, at least everything that I know how to do, in finder. Here are the two places to go to. (Forget .emacs and .emacs.d. Just don't use them.) When you install the Aquamacs DMG, Aquamacs will create in ~/Library/Preferences/Aquamacs Emacs/ a file called Preferences.el. No more .emacs. You can use finder to get to it, open it up with Aquamacs or Textedit, if you like, and you can load in whatever you have a mind to. I have my Preferences.el (notice the cap P, I don't know why they did that, but I wouldn't recommend changing it) in Bookmarks so I can get to it any time. It's about the only file a non-programmer can play around in on Mac OS. It makes for some comic relief. There is another file called customizations.el. I highly recommend, at least for the finer things in life, that you use custom as much as you can figure out how to. But avoid this file like the plague. When you open it it looks like somebody dropped a pot of spaghetti on the floor. If you take it upon yourself to edit something in the fonts section, for instance, and end up with an error message "won't load customizations file", don't say I didn't warn you. You can just delete it and start from scratch; the more often you blow it, the more you'll learn how to avoid blowing it. Also, be aware of the Options tab in the thingy up above there. Lots of good things to click on, as you get into it and want to change appearance or font. If you write like I do, and you're staring at the monitor all day, you are gonna want to change up the looks of things. Incidentally, the ugly drooping tool-bar can be gotten rid of just by clicking on it and picking the "hide toolbar" option. One other thing, Aquamacs has tabs by default, which is in my opinion a good thing.

Also, Aquamacs has spelling that actually works. And it is by default. In Emacs, spelling can be a hassle, but not Aquamacs. Spelling is NOT in Tools (the thingy up above), as it is in Emacs, it is in Edit. It is all there, spelling just works out of the box. If you are the worst possible speller, then you might want Aquamacs to check spelling as you go along. If not, you might want an occasional spell check. Just leave the cursor at the end of the word and key C-$ (that is control-shift-4). If you are working on an older Mac, then key the spellings, if you have a quad-core, 16G of RAM and an OWC SSD extreme, then nothing you do matters very much. If you want completions I have set up a function key for it on F2.

(global-set-key [f2] 'ispell-complete-word)  
Just drop it in your Preferences.el, and restart. But I admit, being into text 99% of the time, I have dis-functioned all of the default Mac function keys. To do this go into System Preferences > keyboard > keyboard shortcuts and every place you see an f, uncheck it. I have a keybinding for everything I do more than twice a day. But nobody would be interested in my keybindings. I just put out the one above as an example. There are many experts on the web, among them ErgoEmacs—to utilize this fine and fanatical man on this subject and many others go here. Once you get into making your own keybindings, things will speed up real fast.

I admit that what I have here on my Mac is a stripper. This is because I fear crashes. On the other hand, the Emacs I have on Xubuntu is very expansive. It is set up for AucTeX, which runs very well, except for a few discussable downfalls, I also have a complete set of yassnippets, zoom-frm, sublimity mode, deft, writeroom, and numerous color themes, too numerous to mention. But Emacs on Xubuntu never crashes. Anyway, I can't remember the last time I had to deal with a crash. On Mountain Lion Emacs crashes all the time, as I have said, and I CANNOT AFFORD TO LOSE ANY TEXT. Therefore the stripper. Though Aquamacs, they are close relatives. But since I am most often writing in raw HTML, as I am now, or raw LaTeX, I really don't need a lot of stuff. Org mode and Muse mode are occasionally useful. Markdown mode is also occasionally useful. As it is I rarely publish in both HTML and LaTeX, and on those occasions that I do, a search and replace or two usually does it, with the help of yassnippets of course.

I believe that AucTeX is most often the principle reason why Emacs crashes in OS X. I don't have much proof except the personal kind, which is: every time I go near AucTeX, shit starts to happen. You can write .tex files all day, but I have no idea how anybody can run AucTeX in Emacs on OS X and not suffer multiple frustrating crashes. (No, there is nothing wrong with my machine. I believe there is one hell of a lot of loyalty to the cause going on in Emacs. Also, most people don't get too annoyed with crashes because they really don't do that much on their machines. Maybe a report every now and then or a school theme.) When I finish a .tex file and I am ready to make the PDF, I just open up TeXshop, make the PDF and launch it, usually in Skim, and start my correction rounds. On Xubuntu I might peek at whizzy-tex, just to prove to myself that the coding here and there is right, then I'll open a DVI and start my correction rounds. You can write notes on Skim and save them and make corrections once the reading is over, which makes the correction process slightly easier.

What you really need, and there is no reason to use Emacs or Aquamacs without it, is yassnippet. And you also need the tab key to expand your snippets with. Otherwise, in my opinion, pack it in. Try something else. The rumor is that yassnippet does not work in Aquamacs, and the tab expand is buggy. But here are the facts. Yas does work in Aquamacs and the tab expand works fine, too. You can get the folder from Elpa or you can steal the folder from a friend. If you steal the folder, or get it from Git or anywhere else, the folder goes into /Library/Application Support/Aquamacs Emacs/Elpa. If you don't have an Elpa folder, make one, or, I guess, you can call it site_lisp if you like, the traditional name. You may have to add a few lisp phrases to your Preferences.el.

  
(add-to-list 'load-path
     "~/Library/Application Support/Aquamacs Emacs/
elpa/yasnippet-20141005.124") (require 'yasnippet) (yas-global-mode 1)
Remember your Preferences.el is in /Library/Preferences/Aquamacs Emacs/. And as I have said, there are no dot files, so you can find the file in Finder, open the file and paste it in. That's as simple as it gets. Restart Aquamacs and yas will work. If it doesn't work, send me a dirty email. One other thing I'd like to point out which has been very helpful. This I borrowed from ErgoEmacs. Everything I have ever gotten from him has always worked1.
(when (>= emacs-major-version 24)
  (require 'package)
  (package-initialize)
  (add-to-list 'package-archives' 
("melpa" . "http://melpa.milkbox.net/packages/") t) )

Add this above to your Preferences.el. Melpa packages usually work out of the box. If there is anything that needs to be added to Preferences.el, they will tell you about it in the notes. By the way you get to Melpa by keying M-X list-packages.

So far so good. No screens of garbage, no crashes. More to come on the differences between Emacs and Aquamacs.


1. He is one of those weird, strange characters who being completely without greed make it possible for shit bums like myself to write books and self-publish efficiently without ending up in the clutches of such behemoths as Adobe who want every drop of blood they can get out of you so their executives can all become billionaires.

No comments:

Post a Comment