Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

365 lines
11 KiB

14 years ago
14 years ago
14 years ago
  1. # Emacs Prelude
  2. ## Prelude
  3. Emacs is probably the best text editor in the world. However, the
  4. process of coming up with a useful Emacs configuration is long and
  5. difficult. It's this process that separates you from truly taking
  6. advantage of Emacs's power. I like to refer to this process as the
  7. **Prelude**. The **Emacs Prelude** has the goal to ease the initial
  8. Emacs setup process and to provide you with a much more powerful and
  9. productive experience than that you get out of the box. By using **Emacs
  10. Prelude** you're basically getting a "Get me out of the Prelude, I
  11. just want to use Emacs" card.
  12. Emacs Prelude is compatible **ONLY with GNU Emacs 24**. While Emacs 24
  13. is not yet officially released it's a rock solid piece of software
  14. more than suitable for everyday work. There is no good excuse not to
  15. use Emacs 24!
  16. ## Fast Forward
  17. Assuming you're using an Unix-like OS (`*BSD`, `GNU/Linux`, `OS X`, `Solaris`,
  18. etc), you already have Emacs 24 installed, as well as `git` & `curl` you
  19. can skip the whole manual and just type in your favorite shell the
  20. following command:
  21. `curl -L
  22. https://github.com/bbatsov/emacs-prelude/raw/master/utils/installer.sh
  23. | sh`
  24. You can now power up your Emacs, sit back and enjoy Prelude,
  25. forgetting about the rest of this manual.
  26. ## Getting Emacs 24
  27. Obviously to use the Emacs Prelude you have to install Emacs 24
  28. first. Here's a few tips on doing so:
  29. ### OS X
  30. Obtaining Emacs 24 on OS X is really simple. There are two popular
  31. ways to do it. The first is to simply download a pretest (or a nightly
  32. build) from [Emacs for OSX](http://emacsformacosx.com). My personal
  33. recommendation would be to get the latest pretest from
  34. [here](http://emacsformacosx.com/builds).
  35. That was really easy, right?
  36. The second easy way to obtain Emacs 24 is via
  37. [homebrew](http://mxcl.github.com/homebrew/). Just type the following
  38. incantation in your shell and you're done:
  39. ```bash
  40. $ brew install emacs --cocoa --use-git-head --HEAD
  41. $ cp -r /usr/local/Cellar/emacs/HEAD/Emacs.app /Applications/
  42. ```
  43. The second step is optional, but it's recommended if you like to start
  44. Emacs from the launchpad or from Spotlight. Personally I prefer to
  45. start Emacs in daemon mode (`emacs --daemon`), so that I could share a
  46. single Emacs instance between several Emacs clients (`emacsclient
  47. -c/t`).
  48. Chances are good you have an older version of Emacs installed by
  49. default with OS X. I suggest you to remove that older Emacs version to
  50. avoid conflicts with the new one. Do this:
  51. ```bash
  52. $ sudo rm /usr/bin/emacs
  53. $ sudo rm -rf /usr/share/emacs
  54. ```
  55. That's all folk! You may now proceed to the configuration section.
  56. ### Linux
  57. Given that Linux is more or less the home os of Emacs it presents us
  58. with the most installation options. Of course, we can build Emacs from
  59. [source](https://github.com/emacsmirror/emacs) on every distribution
  60. out there, but I rarely bother to do so. Using the distribution's
  61. package manager is a better idea for many reasons - you don't need to
  62. install a build chain and lots of dev libraries, you get updated
  63. versions when they are released and you get automated dependency
  64. manager, just to name a few.
  65. That said, few distributions include in their primary repositories
  66. builds of Emacs 24. Luckily there are some unofficial repos that come
  67. to the rescue.
  68. Debian users should look no further than the amazing
  69. [emacs-snapshot APT repo](http://emacs.naquadah.org/). You'll find
  70. installation instructions there for all the relevant Debian
  71. versions out there. High quality, highly recommended builds! After
  72. you've added the repo you can install Emacs 24 with the following
  73. command:
  74. ```bash
  75. $ sudo apt-get install emacs-snapshot
  76. ```
  77. Ubuntu users have easy access to Emacs 24 as well:
  78. ```bash
  79. $ sudo apt-add-repository ppa:cassou/emacs
  80. $ sudo apt-get install emacs-snapshot
  81. ```
  82. Gentoo users have even less to do, since Emacs 24 can be obtained via
  83. the emacs-vcs package in portage, as noted in the official
  84. [Emacs on Gentoo page](http://www.gentoo.org/proj/en/lisp/emacs/emacs.xml).
  85. Unfortunately I wasn't able to find prebuilt Emacs 24 packages for any
  86. of the RPM distros (Fedora, SUSE, Mandriva, etc). Since, I'm Debian
  87. user I have to admit that I didn't look that far, but the source
  88. installation is not particularly hard and is always an option.
  89. ### Windows
  90. There are several ways to obtain precompiled Emacs 24 binaries if
  91. you're a Windows users. The most popular are
  92. [EmacsW32](http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl),
  93. [Emacs for Windows](http://code.google.com/p/emacs-for-windows/) and
  94. of course the official
  95. [Emacs Windows builds](http://alpha.gnu.org/gnu/emacs/windows/). I've
  96. ,personally, never used any builds other than the official ones. The
  97. unofficial builds usually include installers and various patches that
  98. might be of use to some users.
  99. Since I rarely use Windows I cannot give you any more advice on the
  100. choice of a binary vendor.
  101. ## Enhanced programming experience
  102. The following list will be expanded greatly in the future.
  103. ### Additional programming languages support
  104. * [Clojure](https://github.com/technomancy/clojure-mode)
  105. * [CoffeeScript](https://github.com/defunkt/coffee-mode)
  106. * [Erlang](http://www.erlang.org/doc/apps/tools/erlang_mode_chapter.html)
  107. * [Groovy](http://groovy.codehaus.org/Emacs+Groovy+Mode)
  108. * [Haskell](http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs)
  109. ### Additional markup languages support
  110. * Markdown
  111. * Sass
  112. * Haml
  113. * Yaml
  114. * LaTeX
  115. ### Enhanced configuration
  116. * C
  117. * Clojure
  118. * CoffeeScript
  119. * Common Lisp
  120. * ERC
  121. * JavaScript
  122. * Python
  123. * Ruby
  124. * Scheme
  125. * XML
  126. ## Enhanced productivity
  127. * [Projectile](https://github.com/bbatsov/projectile)
  128. * yasnippet
  129. ## Bundled packages
  130. * auctex (LaTeX editing)
  131. * clojure-mode
  132. * coffee-mode
  133. * deft (note taking)
  134. * gist (snippet sharing on github.com)
  135. * groovy-mode
  136. * expand-region
  137. * haml-mode
  138. * haskell-mode
  139. * magit (enhanced git integration)
  140. * markdown-mode
  141. * paredit
  142. * projectile (project management mode)
  143. * python.el (improved Python mode)
  144. * sass-mode
  145. * scss-mode
  146. * yaml-mode
  147. * yari (ri frontend)
  148. * yasnippet
  149. ## Installation
  150. ### Automated
  151. You can install Emacs via the command line with either `curl` or
  152. `wget`. Naturally `git` is also required.
  153. #### Via Curl
  154. If you're using `curl` type the following command:
  155. `curl -L https://github.com/bbatsov/emacs-prelude/raw/master/utils/installer.sh | sh`
  156. #### Via Wget
  157. If you're using `wget` type:
  158. `wget --no-check-certificate https://github.com/bbatsov/emacs-prelude/raw/master/utils/installer.sh -O - | sh`
  159. ### Manual
  160. ```bash
  161. $ git clone git://github.com/bbatsov/emacs-prelude.git path/to/local/repo
  162. $ ln -s path/to/local/repo ~/.emacs.d
  163. ```
  164. You'd do well to replace `~/.emacs.d` with the value of
  165. `user-emacs-directory` for your OS. You can check the value by doing
  166. `C-h v user-emacs-directory` inside Emacs.
  167. You might have to install the `make` and `makeinfo` packages if you
  168. don't have them already, since the build of some packages obtained via
  169. `el-get` might require them.
  170. ## Running
  171. Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
  172. in daemon mode:
  173. `$ emacs --daemon`
  174. Afterwards I connect to the server with either a terminal or a GUI
  175. client like this:
  176. ```bash
  177. $ emacsclient -t
  178. $ emacsclient -c
  179. ```
  180. You'd probably do well to put a few aliases in your `.zshrc` (or
  181. `.bashrc`):
  182. ```bash
  183. alias e=emacsclient -t
  184. alias ec=emacsclient -c
  185. alias vim=emacsclient -t
  186. alias vi=emacsclient -t
  187. ```
  188. The last two aliases are helpful if you're used to editing files from
  189. the command line using `vi(m)`.
  190. ## Getting to know Prelude
  191. Certainly the best way to understand how Prelude enhances the default
  192. Emacs experience is to peruse Prelude's source code (which is
  193. obviously written in Emacs Lisp). If you're intimidated by the source
  194. - do not despair. Prelude includes a `prelude-mode` minor Emacs mode
  195. which collects some of the additional functionality added by
  196. Prelude. It also adds an additional keymap that binds many of those
  197. extensions to keybindings.
  198. ## Color Themes
  199. Emacs 24 ships with a new theming facility that effectively renders
  200. the old color-theme package obsolete. Emacs 24 provides a dozen of
  201. built-in themes you can use out-of-the-box by invoking the `M-x
  202. load-theme` command. Emacs Prelude adds two more popular themes to the
  203. mix - [Zenburn](https://github.com/bbatsov/zenburn-emacs) and
  204. [Solarized](https://github.com/bbatsov/solarized-emacs) (I'm the
  205. maintainer of the Emacs ports included).
  206. Zenburn is the default color theme in Prelude, but you can change it
  207. at your discretion. Why Zenburn? I (and lots of hackers around the
  208. world) find it pretty neat for some reason. Personally I find the
  209. default theme pretty tiresome for the eyes, that's why I took that
  210. "controversial" decision to replace it. You can, of course, easily go
  211. back to the default (or select another theme entirely).
  212. To disable Zenburn just put in your personal config the following
  213. line:
  214. ```elisp
  215. (disable-theme 'zenburn)
  216. ```
  217. Or you can use another theme altogether by adding something like:
  218. ```elisp
  219. (load-theme 'solarized-dark t)
  220. ```
  221. ## Personalizing
  222. If you'd like to change some of the setting in Prelude (or simply add
  223. more) the proper way to do so would be to create Emacs Lisp files
  224. under the **personal** directory in `prelude-dir`. They will be loaded
  225. automatically be Prelude on startup.
  226. Avoid modifying the Prelude config itself (unless you're not
  227. intimidated to maintain a personal fork on GitHub) - this will make it
  228. hard for you to receive automatic updates in the future.
  229. ## Caveats & Pitfalls
  230. ### Ugly colors in the terminal Emacs version
  231. If your Emacs looks considerably uglier in a terminal (compared to the
  232. GUI version) try adding this to your `.bashrc` or `.zshrc`:
  233. ```bash
  234. export TERM=xterm-256color
  235. ```
  236. Source the `.bashrc` file and start Emacs again.
  237. ### Marmalade error on initial startup
  238. If you get some http connection error related to the Marmalade repo
  239. just do a manual `M-x package-refresh-contents` and restart Emacs
  240. afterwards.
  241. ### No arrow navigation in editor buffers
  242. This is not a bug - it's a feature! I firmly believe that the one true
  243. way to use Emacs is by using it the way it was intended to be used (as
  244. far as navigation is concerned at least). That's why I've disabled all
  245. movement commands with arrows - to prevent you from being tempted to
  246. use them.
  247. If you'd still like to use the arrow keys just invoke `M-x
  248. prelude-restore-arrow-keys` to enable them for the duration of your
  249. current Emacs session or add `(prelude-restore-arrow-keys)` to your
  250. personal Emacs customization to enable them permanently.
  251. ### Windows compatibility
  252. While everything in Prelude should work fine in Windows, I test it only
  253. with Linux & OSX, so there are Windows related problems from time to
  254. time. This situation will probably improve over time.
  255. ## Known issues
  256. Check out the project's
  257. [issue list](https://github.com/bbatsov/emacs-prelude/issues?sort=created&direction=desc&state=open)
  258. a list of unresolved issues. By the way - feel free to fix any of them
  259. and sent me a pull request. :-)
  260. ## Contributors
  261. Here's a [list](https://github.com/bbatsov/emacs-prelude/contributors) of all the people who have contributed to the
  262. development of Emacs Prelude.
  263. ## Bugs & Improvements
  264. Bug reports and suggestions for improvements are always
  265. welcome. github pull requests are even better! :-)
  266. I'd like to include a nice variety of Emacs 24 themes into Prelude -
  267. so if you've developed (or simply found) one - give me a shout and
  268. I'll take a look at it.
  269. Cheers,<br>
  270. Bozhidar