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.

396 lines
12 KiB

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