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.

401 lines
13 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. $ cd ~/emacs.d
  172. $ git submodule init
  173. $ git submodule update
  174. ```
  175. You'd do well to replace `~/.emacs.d` with the value of
  176. `user-emacs-directory` for your OS. You can check the value by doing
  177. `C-h v user-emacs-directory` inside Emacs.
  178. You might have to install the `make` and `makeinfo` packages if you
  179. don't have them already, since the build of some packages obtained via
  180. `el-get` might require them.
  181. ## Running
  182. Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
  183. in daemon mode:
  184. `$ emacs --daemon`
  185. Afterwards I connect to the server with either a terminal or a GUI
  186. client like this:
  187. ```bash
  188. $ emacsclient -t
  189. $ emacsclient -c
  190. ```
  191. You'd probably do well to put a few aliases in your `.zshrc` (or
  192. `.bashrc`):
  193. ```bash
  194. alias e=emacsclient -t
  195. alias ec=emacsclient -c
  196. alias vim=emacsclient -t
  197. alias vi=emacsclient -t
  198. ```
  199. The last two aliases are helpful if you're used to editing files from
  200. the command line using `vi(m)`.
  201. ## Getting to know Prelude
  202. Certainly the best way to understand how Prelude enhances the default
  203. Emacs experience is to peruse Prelude's source code (which is
  204. obviously written in Emacs Lisp). If you're intimidated by the source
  205. - do not despair. Prelude includes a `prelude-mode` minor Emacs mode
  206. which collects some of the additional functionality added by
  207. Prelude. It also adds an additional keymap that binds many of those
  208. extensions to keybindings.
  209. ## Color Themes
  210. Emacs 24 ships with a new theming facility that effectively renders
  211. the old color-theme package obsolete. Emacs 24 provides a dozen of
  212. built-in themes you can use out-of-the-box by invoking the `M-x
  213. load-theme` command. Emacs Prelude adds two more popular themes to the
  214. mix - [Zenburn](https://github.com/bbatsov/zenburn-emacs) and
  215. [Solarized](https://github.com/bbatsov/solarized-emacs) (I'm the
  216. maintainer of the Emacs ports included).
  217. Zenburn is the default color theme in Prelude, but you can change it
  218. at your discretion. Why Zenburn? I (and lots of hackers around the
  219. world) find it pretty neat for some reason. Personally I find the
  220. default theme pretty tiresome for the eyes, that's why I took that
  221. "controversial" decision to replace it. You can, of course, easily go
  222. back to the default (or select another theme entirely).
  223. To disable Zenburn just put in your personal config the following
  224. line:
  225. ```elisp
  226. (disable-theme 'zenburn)
  227. ```
  228. Or you can use another theme altogether by adding something like:
  229. ```elisp
  230. (load-theme 'solarized-dark t)
  231. ```
  232. ## Personalizing
  233. If you'd like to change some of the setting in Prelude (or simply add
  234. more) the proper way to do so would be to create Emacs Lisp files
  235. under the **personal** directory in `prelude-dir`. They will be loaded
  236. automatically be Prelude on startup. The directory is backed by a git
  237. submodule, so you can easily track your own personalizations via
  238. git.
  239. Avoid modifying the Prelude config itself (unless you're not
  240. intimidated to maintain a personal fork on GitHub) - this will make it
  241. hard for you to receive automatic updates in the future.
  242. ## Caveats & Pitfalls
  243. ### Problems with flyspell-mode
  244. Prelude makes heavy use of the flyspell-mode package for spell
  245. checking of various things. The proper operation of flyspell depends
  246. on the presence of the `aspell` program and an `en` dictionary on your
  247. system. You can install `aspell` and the dictionary on OS X with
  248. `homebrew` like this:
  249. ```bash
  250. $ brew install aspell --lang=en
  251. ```
  252. On Linux distros - just use your distro's package manager.
  253. ### Ugly colors in the terminal Emacs version
  254. If your Emacs looks considerably uglier in a terminal (compared to the
  255. GUI version) try adding this to your `.bashrc` or `.zshrc`:
  256. ```bash
  257. export TERM=xterm-256color
  258. ```
  259. Source the `.bashrc` file and start Emacs again.
  260. ### Marmalade error on initial startup
  261. If you get some http connection error related to the Marmalade repo
  262. just do a manual `M-x package-refresh-contents` and restart Emacs
  263. afterwards.
  264. ### No arrow navigation in editor buffers
  265. This is not a bug - it's a feature! I firmly believe that the one true
  266. way to use Emacs is by using it the way it was intended to be used (as
  267. far as navigation is concerned at least). That's why I've disabled all
  268. movement commands with arrows - to prevent you from being tempted to
  269. use them.
  270. If you'd still like to use the arrow keys just invoke `M-x
  271. prelude-restore-arrow-keys` to enable them for the duration of your
  272. current Emacs session or add `(prelude-restore-arrow-keys)` to your
  273. personal Emacs customization to enable them permanently.
  274. ### Windows compatibility
  275. While everything in Prelude should work fine in Windows, I test it only
  276. with Linux & OSX, so there are Windows related problems from time to
  277. time. This situation will probably improve over time.
  278. ## Share the knowledge
  279. [WikEmacs](http://wikemacs.org) collects useful resources for working
  280. with GNU Emacs. Please, take the time to peruse and improve them as
  281. you accumulate knowledge about Emacs. Prelude makes this especially
  282. easy, since it bundles
  283. [MediaWiki support](http://wikemacs.org/wiki/Mediawiki.el) + the
  284. settings required to access WikEmacs right away.
  285. ## Known issues
  286. Check out the project's
  287. [issue list](https://github.com/bbatsov/emacs-prelude/issues?sort=created&direction=desc&state=open)
  288. a list of unresolved issues. By the way - feel free to fix any of them
  289. and sent me a pull request. :-)
  290. ## Contributors
  291. Here's a [list](https://github.com/bbatsov/emacs-prelude/contributors) of all the people who have contributed to the
  292. development of Emacs Prelude.
  293. ## Bugs & Improvements
  294. Bug reports and suggestions for improvements are always
  295. welcome. github pull requests are even better! :-)
  296. I'd like to include a nice variety of Emacs 24 themes into Prelude -
  297. so if you've developed (or simply found) one - give me a shout and
  298. I'll take a look at it.
  299. Cheers,<br>
  300. Bozhidar