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.

286 lines
8.9 KiB

14 years ago
14 years ago
14 years ago
14 years ago
  1. Emacs Prelude
  2. =============
  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**. **Emacs Prelude** has the goal to ease the initial Emacs
  8. setup process and to provide you with a much more powerful and
  9. productive experience than the one you get out of the box. By using
  10. **Emacs Prelude** you're basically getting a *"Get me out of the
  11. Prelude, I just want to use Emacs"* card.
  12. Emacs Prelude is compatible **ONLY with GNU Emacs 24.x**.
  13. ## Fast Forward
  14. Assuming you're using an Unix-like OS (`*BSD`, `GNU/Linux`, `OS X`, `Solaris`,
  15. etc), you already have Emacs 24 installed, as well as `git` & `curl` you
  16. can skip the whole manual and just type in your favorite shell the
  17. following command:
  18. ```bash
  19. $ curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  20. ```
  21. You can now power up your Emacs, sit back and enjoy Prelude,
  22. forgetting about the rest of this manual.
  23. There are two environment variables you can use to control the
  24. source repository and the installation directory. To change the
  25. installation directory:
  26. ```bash
  27. $ PRELUDE_INSTALL_DIR="$HOME/.emacs.d" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  28. ```
  29. To change the source repository:
  30. ```bash
  31. $ PRELUDE_URL="https://github.com/yourname/prelude.git" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  32. ```
  33. Note that the installer will back up any existing `.emacs` file or
  34. `.emacs.d` since it will unpack Prelude's code in `.emacs.d`. If
  35. you're doing a manual install make sure you don't have a `.emacs` file
  36. or back up your existing `.emacs.d` directory manually.
  37. ## More goodies
  38. The [Prelude Modules](https://github.com/bbatsov/prelude-modules)
  39. project contains a lot of additional packages for Prelude
  40. (install-able via the `package-list-packages` command) - enhanced programming
  41. mode configs, latex config, erc config, etc.
  42. ## Installing Emacs 24
  43. Obviously to use the Emacs Prelude you have to install Emacs 24
  44. first. Have a look at the [WikEmacs articles on installing Emacs](http://wikemacs.org/wiki/Installing_Emacs).
  45. ## Installation
  46. ### Automated
  47. You can install **Emacs Prelude** via the command line with either `curl` or
  48. `wget`. Naturally `git` is also required.
  49. #### Via Curl
  50. If you're using `curl` type the following command:
  51. ```bash
  52. $ curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  53. ```
  54. #### Via Wget
  55. If you're using `wget` type:
  56. ```bash
  57. $ wget --no-check-certificate https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O - | sh
  58. ```
  59. ### Manual
  60. ```bash
  61. $ git clone git://github.com/bbatsov/prelude.git path/to/local/repo
  62. $ ln -s path/to/local/repo ~/.emacs.d
  63. $ cd ~/emacs.d
  64. ```
  65. You'd do well to replace `~/.emacs.d` with the value of
  66. `user-emacs-directory` for your OS. You can check the value by doing
  67. `C-h v user-emacs-directory` inside Emacs.
  68. ## Running
  69. Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
  70. in daemon mode:
  71. ```bash
  72. $ emacs --daemon
  73. ```
  74. Afterwards I connect to the server with either a terminal or a GUI
  75. client like this:
  76. ```bash
  77. $ emacsclient -t
  78. $ emacsclient -c
  79. ```
  80. You'd probably do well to put a few aliases in your `.zshrc` (or
  81. `.bashrc`):
  82. ```bash
  83. alias e=emacsclient -t
  84. alias ec=emacsclient -c
  85. alias vim=emacsclient -t
  86. alias vi=emacsclient -t
  87. ```
  88. The last two aliases are helpful if you're used to editing files from
  89. the command line using `vi(m)`.
  90. ## Getting to know Prelude
  91. Certainly the best way to understand how Prelude enhances the default
  92. Emacs experience is to peruse Prelude's source code (which is
  93. obviously written in Emacs Lisp). Understanding the code is not
  94. necessary of course. Prelude includes a `prelude-mode` minor Emacs mode
  95. which collects some of the additional functionality added by
  96. Prelude. It also adds an additional keymap that binds many of those
  97. extensions to keybindings.
  98. ### Automatic package installation
  99. The default Prelude installation comes with a bare minimum of
  100. functionality. It will however install add-ons for various programming
  101. languages and frameworks on demand. For instance - if you try to open
  102. a `.clj` file `clojure-mode`, `nrepl.el` and prelude's enhanced Lisp
  103. configuration will be installed automatically for you.
  104. You can, of course, install anything you wish manually as well.
  105. ### Color Themes
  106. Emacs 24 ships with a new theming facility that effectively renders
  107. the old color-theme package obsolete. Emacs 24 provides a dozen of
  108. built-in themes you can use out-of-the-box by invoking the `M-x
  109. load-theme` command.
  110. [Zenburn](https://github.com/bbatsov/zenburn-emacs) is the default color theme in Prelude, but you can change it
  111. at your discretion. Why Zenburn? I (and lots of hackers around the
  112. world) find it pretty neat for some reason. Personally I find the
  113. default theme pretty tiresome for the eyes, that's why I took that
  114. "controversial" decision to replace it. You can, of course, easily go
  115. back to the default (or select another theme entirely).
  116. To disable Zenburn just put in your personal config the following
  117. line:
  118. ```lisp
  119. (disable-theme 'zenburn)
  120. ```
  121. Or you can use another theme altogether by adding something like:
  122. ```lisp
  123. (load-theme 'solarized-dark t)
  124. ```
  125. P.S. Solarized is not available by default - you'll have to install it from MELPA first.
  126. ### Personalizing
  127. Fork the official Prelude repo and add your own touch to it. You're advised to avoid changing stuff outside of the
  128. personal folder to avoid having to deal with git merge conflicts in the future.
  129. #### Disable whitespace-mode
  130. Some people find `whitespace-mode` too intrusive and might want to
  131. disable it. It come be done from your personal config with the
  132. following bit of code:
  133. ```lisp
  134. (add-hook 'prog-mode-hook 'prelude-turn-off-whitespace t)
  135. ```
  136. #### Disable flyspell-mode
  137. If you're not fond of spellchecking on the fly:
  138. ```lisp
  139. (add-hook 'text-mode-hook 'turn-off-flyspell t)
  140. (add-hook 'prog-mode-hook 'turn-off-flyspell t)
  141. ```
  142. ### Prelude Modules
  143. Additional settings for various programming languages are available for installation via MELPA. You might take a look at the [Prelude Modules project](https://github.com/bbatsov/prelude-modules) for further info.
  144. ## Caveats & Pitfalls
  145. ### Problems with flyspell-mode
  146. Prelude makes heavy use of the flyspell-mode package for spell
  147. checking of various things. The proper operation of flyspell depends
  148. on the presence of the `aspell` program and an `en` dictionary on your
  149. system. You can install `aspell` and the dictionary on OS X with
  150. `homebrew` like this:
  151. ```bash
  152. $ brew install aspell --lang=en
  153. ```
  154. On Linux distros - just use your distro's package manager.
  155. ### Ugly colors in the terminal Emacs version
  156. If your Emacs looks considerably uglier in a terminal (compared to the
  157. GUI version) try adding this to your `.bashrc` or `.zshrc`:
  158. ```bash
  159. $ export TERM=xterm-256color
  160. ```
  161. Source the `.bashrc` file and start Emacs again.
  162. ### MELPA error on initial startup
  163. If you get some http connection error related to the MELPA repo
  164. just do a manual `M-x package-refresh-contents` and restart Emacs
  165. afterwards.
  166. ### No arrow navigation in editor buffers
  167. This is not a bug - it's a feature! I firmly believe that the one true
  168. way to use Emacs is by using it the way it was intended to be used (as
  169. far as navigation is concerned at least). That's why I've disabled all
  170. movement commands with arrows (and keys like page up, page down, etc) - to prevent you from being tempted to
  171. use them.
  172. If you'd still like to use the arrow keys just invoke `M-x
  173. guru-mode` to enable them for the duration of your
  174. current Emacs session or add the following snippet to your
  175. personal Emacs customization to enable them permanently:
  176. ```lisp
  177. (add-hook 'prog-mode-hook 'turn-off-guru-mode t)
  178. ```
  179. ### Windows compatibility
  180. While everything in Prelude should work fine in Windows, I test it only
  181. with Linux & OSX, so there are Windows related problems from time to
  182. time. This situation will probably improve over time.
  183. ## Share the knowledge
  184. [WikEmacs](http://wikemacs.org) collects useful resources for working
  185. with GNU Emacs. Please, take the time to peruse and improve them as
  186. you accumulate knowledge about Emacs. Prelude makes this especially
  187. easy, since it bundles
  188. [MediaWiki support](http://wikemacs.org/wiki/Mediawiki.el) + the
  189. settings required to access WikEmacs right away.
  190. ## Known issues
  191. Check out the project's
  192. [issue list](https://github.com/bbatsov/prelude/issues?sort=created&direction=desc&state=open)
  193. a list of unresolved issues. By the way - feel free to fix any of them
  194. and send me a pull request. :-)
  195. ## Contributors
  196. Here's a [list](https://github.com/bbatsov/prelude/contributors) of all the people who have contributed to the
  197. development of Emacs Prelude.
  198. ## Bugs & Improvements
  199. Bug reports and suggestions for improvements are always
  200. welcome. GitHub pull requests are even better! :-)
  201. Cheers,<br/>
  202. Bozhidar