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.

322 lines
10 KiB

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