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.

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