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.

345 lines
11 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. ## 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 (which is ironically
  34. the first pretest as well) from
  35. [here](http://emacsformacosx.com/emacs-builds/Emacs-pretest-24.0.90-universal-10.6.7.dmg).
  36. That was really easy, right?
  37. The second easy way to obtain Emacs 24 is via
  38. [homebrew](http://mxcl.github.com/homebrew/). Just type the following
  39. incantation in your shell and you're done:
  40. ```bash
  41. $ brew install emacs --cocoa --use-git-head --HEAD
  42. $ cp -r /usr/local/Cellar/emacs/HEAD/Emacs.app /Applications/
  43. ```
  44. The second step is optional, but it's recommended if you like to start
  45. Emacs from the launchpad or from Spotlight. Personally I prefer to
  46. start Emacs in daemon mode (`emacs --daemon`), so that I could share a
  47. single Emacs instance between several Emacs clients (`emacsclient
  48. -c/t`).
  49. Chances are good you have an older version of Emacs installed by
  50. default with OS X. I suggest you to remove that older Emacs version to
  51. avoid conflicts with the new one. Do this:
  52. ```bash
  53. $ sudo rm /usr/bin/emacs
  54. $ sudo rm -rf /usr/share/emacs
  55. ```
  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! After
  73. you've added the repo you can install Emacs 24 with the following
  74. command:
  75. ```bash
  76. $ sudo apt-get install emacs-snapshot
  77. ```
  78. Gentoo users have even less to do, since Emacs 24 can be obtained via
  79. the emacs-vcs package in portage, as noted in the official
  80. [Emacs on Gentoo page](http://www.gentoo.org/proj/en/lisp/emacs/emacs.xml).
  81. Unfortunately I wasn't able to find prebuilt Emacs 24 packages for any
  82. of the RPM distros (Fedora, SUSE, Mandriva, etc). Since, I'm Debian
  83. user I have to admit that I didn't look that far, but the source
  84. installation is not particularly hard and is always an option.
  85. ### Windows
  86. There are several ways to obtain precompiled Emacs 24 binaries if
  87. you're a Windows users. The most popular are
  88. [EmacsW32](http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl),
  89. [Emacs for Windows](http://code.google.com/p/emacs-for-windows/) and
  90. of course the official
  91. [Emacs Windows builds](http://alpha.gnu.org/gnu/emacs/windows/). I've
  92. ,personally, never used any builds other than the official ones. The
  93. unofficial builds usually include installers and various patches that
  94. might be of use to some users.
  95. Since I rarely use Windows I cannot give you any more advice on the
  96. choice of a binary vendor.
  97. ## Enhanced programming experience
  98. The following list will be expanded greatly in the future.
  99. ### Additional programming languages support
  100. * [Clojure](https://github.com/technomancy/clojure-mode)
  101. * [CoffeeScript](https://github.com/defunkt/coffee-mode)
  102. * [Erlang](http://www.erlang.org/doc/apps/tools/erlang_mode_chapter.html)
  103. * [Groovy](http://groovy.codehaus.org/Emacs+Groovy+Mode)
  104. * [Haskell](http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs)
  105. ### Additional markup languages support
  106. * Markdown
  107. * Sass
  108. * Haml
  109. * Yaml
  110. * LaTeX
  111. ### Enhanced configuration
  112. * C
  113. * Clojure
  114. * CoffeeScript
  115. * Common Lisp
  116. * ERC
  117. * JavaScript
  118. * Python
  119. * Ruby
  120. * Scheme
  121. * XML
  122. ## Enhanced productivity
  123. * [Projectile](https://github.com/bbatsov/projectile)
  124. * yasnippet
  125. ## Bundled packages
  126. * auctex (LaTeX editing)
  127. * clojure-mode
  128. * coffee-mode
  129. * deft (note taking)
  130. * gist (snippet sharing on github.com)
  131. * groovy-mode
  132. * expand-region
  133. * haml-mode
  134. * haskell-mode
  135. * magit (enhanced git integration)
  136. * markdown-mode
  137. * paredit
  138. * projectile (project management mode)
  139. * python.el (improved Python mode)
  140. * sass-mode
  141. * scss-mode
  142. * yaml-mode
  143. * yari (ri frontend)
  144. * yasnippet
  145. ## Installation
  146. ### Automated
  147. You can install Emacs via the command line with either `curl` or
  148. `wget`. Naturally `git` is also required.
  149. #### Via Curl
  150. If you're using `curl` type the following command:
  151. `curl -L https://github.com/bbatsov/emacs-prelude/raw/master/utils/installer.sh | sh`
  152. #### Via Wget
  153. If you're using `wget` type:
  154. `wget --no-check-certificate https://github.com/bbatsov/emacs-prelude/raw/master/utils/installer.sh -O - | sh`
  155. ### Manual
  156. ```bash
  157. $ git clone git://github.com/bbatsov/emacs-prelude.git path/to/local/repo
  158. $ ln -s path/to/local/repo ~/.emacs.d
  159. ```
  160. You'd do well to replace `~/.emacs.d` with the value of
  161. `user-emacs-directory` for your OS. You can check the value by doing
  162. `C-h v user-emacs-directory` inside Emacs.
  163. You might have to install the `make` and `makeinfo` packages if you
  164. don't have them already, since the build of some packages obtained via
  165. `el-get` might require them.
  166. ## Running
  167. Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
  168. in daemon mode:
  169. `$ emacs --daemon`
  170. Afterwards I connect to the server with either a terminal or a GUI
  171. client like this:
  172. ```bash
  173. $ emacsclient -t
  174. $ emacsclient -c
  175. ```
  176. You'd probably do well to put a few aliases in your `.zshrc` (or
  177. `.bashrc`):
  178. ```bash
  179. alias e=emacsclient -t
  180. alias ec=emacsclient -c
  181. alias vim=emacsclient -t
  182. alias vi=emacsclient -t
  183. ```
  184. The last two aliases are helpful if you're used to editing files from
  185. the command line using `vi(m)`.
  186. ## Getting to know Prelude
  187. Certainly the best way to understand how Prelude enhances the default
  188. Emacs experience is to peruse Prelude's source code (which is
  189. obviously written in Emacs Lisp). If you're intimidated by the source
  190. - do not despair. Prelude includes a `prelude-mode` minor Emacs mode
  191. which collects some of the additional functionality added by
  192. Prelude. It also adds an additional keymap that binds many of those
  193. extensions to keybindings.
  194. ## Color Themes
  195. Emacs 24 ships with a new theming facility that effectively renders
  196. the old color-theme package obsolete. Emacs 24 provides a dozen of
  197. built-in themes you can use out-of-the-box by invoking the `M-x
  198. load-theme` command. Emacs Prelude adds two more popular themes to the
  199. mix - [Zenburn](https://github.com/bbatsov/zenburn-emacs) and
  200. [Solarized](https://github.com/bbatsov/solarized-emacs) (I'm the
  201. maintainer of the Emacs ports included).
  202. Zenburn is the default color theme in Prelude, but you can change it
  203. at your discretion. Why Zenburn? I (and lots of hackers around the
  204. world) find it pretty neat for some reason. Personally I find the
  205. default theme pretty tiresome for the eyes, that's why I took that
  206. "controversial" decision to replace it. You can, of course, easily go
  207. back to the default (or select another theme entirely).
  208. To disable Zenburn just put in your personal config the following
  209. line:
  210. ```elisp
  211. (disable-theme 'zenburn)
  212. ```
  213. Or you can use another theme altogether by adding something like:
  214. ```elisp
  215. (enable-theme 'solarized-dark t)
  216. ```
  217. ## Personalizing
  218. If you'd like to change some of the setting in Prelude (or simply add
  219. more) the proper way to do so would be to create Emacs Lisp files
  220. under the **personal** directory in `prelude-dir`. They will be loaded
  221. automatically be Prelude on startup.
  222. Avoid modifying the Prelude config itself (unless you're not
  223. intimidated to maintain a personal fork on GitHub)- this will make it
  224. hard for you to receive automatic updates in the future.
  225. ## Caveats & Pitfalls
  226. ### Marmalade error on initial startup
  227. If you get some http connection error related to the Marmalade repo
  228. just do a manual `M-x package-refresh-contents` and restart Emacs
  229. afterwards.
  230. ### No arrow navigation in editor buffers
  231. This is not a bug - it's a feature! I firmly believe that the one true
  232. way to use Emacs is by using it the way it was intended to be used (as
  233. far as navigation is concerned at least). That's why I've disabled all
  234. movement commands with arrows - to prevent you from being tempted to
  235. use them.
  236. If you'd still like to use the arrow keys just invoke `M-x
  237. prelude-restore-arrow-keys` to enable them for the duration of your
  238. current Emacs session or add `(prelude-restore-arrow-keys)` to your
  239. personal Emacs customization to enable them permanently.
  240. ### Windows compatibility
  241. While everything in Prelude should work fine in Windows, I test it only
  242. with Linux & OSX, so there are Windows related problems from time to
  243. time. This situation will probably improve over time.
  244. ## Known issues
  245. Check out the project's [issue list](https://github.com/bbatsov/emacs-prelude/issues?sort=created&direction=desc&state=open) for that. :-)
  246. ## Contributors
  247. Here's a [list](https://github.com/bbatsov/emacs-prelude/contributors) of all the people who have contributed to the
  248. development of Emacs Prelude.
  249. ## Bugs & Improvements
  250. Bug reports and suggestions for improvements are always
  251. welcome. github pull requests are even better! :-)
  252. I'd like to include a nice variety of Emacs 24 themes into Prelude -
  253. so if you've developed (or simply found) one - give me a shout and
  254. I'll take a look at it.
  255. Cheers,<br>
  256. Bozhidar