├── personal └── .gitkeep ├── themes └── .gitkeep ├── vendor └── .gitkeep ├── .projectile ├── .gitignore ├── modules ├── prelude-markdown.el ├── prelude-scheme.el ├── prelude-scala.el ├── prelude-js.el ├── prelude-scss.el ├── prelude-css.el ├── prelude-xml.el ├── prelude-org.el ├── prelude-python.el ├── prelude-mediawiki.el ├── prelude-haskell.el ├── prelude-erlang.el ├── prelude-lisp.el ├── prelude-c.el ├── prelude-latex.el ├── prelude-clojure.el ├── prelude-perl.el ├── prelude-coffee.el ├── prelude-ruby.el ├── prelude-emacs-lisp.el ├── prelude-common-lisp.el ├── prelude-programming.el └── prelude-erc.el ├── sample └── prelude-modules.el ├── CONTRIBUTING.md ├── core ├── prelude-osx.el ├── prelude-ui.el ├── prelude-global-keybindings.el ├── prelude-packages.el ├── prelude-mode.el ├── prelude-editor.el └── prelude-core.el ├── init.el ├── utils └── installer.sh └── README.md /personal/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.projectile: -------------------------------------------------------------------------------- 1 | /elpa 2 | /savefile -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.elc 3 | auto-save-list 4 | recentf 5 | savehist 6 | saveplace 7 | eshell 8 | elpa 9 | el-get 10 | semanticdb 11 | url 12 | ede-projects.el 13 | .DS_Store 14 | custom.el 15 | places 16 | .smex-items 17 | savefile/ 18 | /prelude-modules.el 19 | projectile-bookmarks.eld 20 | session* 21 | -------------------------------------------------------------------------------- /modules/prelude-markdown.el: -------------------------------------------------------------------------------- 1 | (prelude-ensure-module-deps '(markdown-mode)) 2 | 3 | (setq markdown-imenu-generic-expression 4 | '(("title" "^\\(.*\\)[\n]=+$" 1) 5 | ("h2-" "^\\(.*\\)[\n]-+$" 1) 6 | ("h1" "^# \\(.*\\)$" 1) 7 | ("h2" "^## \\(.*\\)$" 1) 8 | ("h3" "^### \\(.*\\)$" 1) 9 | ("h4" "^#### \\(.*\\)$" 1) 10 | ("h5" "^##### \\(.*\\)$" 1) 11 | ("h6" "^###### \\(.*\\)$" 1) 12 | ("fn" "^\\[\\^\\(.*\\)\\]" 1))) 13 | 14 | (add-hook 'markdown-mode-hook 15 | (lambda () 16 | (setq imenu-generic-expression markdown-imenu-generic-expression))) 17 | 18 | (provide 'prelude-markdown) 19 | -------------------------------------------------------------------------------- /sample/prelude-modules.el: -------------------------------------------------------------------------------- 1 | ;;; Uncomment the modules you'd like to use and restart Prelude afterwards 2 | 3 | (require 'prelude-c) 4 | ;; (require 'prelude-clojure) 5 | ;; (require 'prelude-coffee) 6 | ;; (require 'prelude-common-lisp) 7 | ;; (require 'prelude-css) 8 | (require 'prelude-emacs-lisp) 9 | (require 'prelude-erc) 10 | ;; (require 'prelude-erlang) 11 | ;; (require 'prelude-haskell) 12 | (require 'prelude-js) 13 | ;; (require 'prelude-latex) 14 | (require 'prelude-lisp) 15 | ;; (require 'prelude-markdown) 16 | ;; (require 'prelude-mediawiki) 17 | (require 'prelude-org) 18 | (require 'prelude-perl) 19 | ;; (require 'prelude-python) 20 | ;; (require 'prelude-ruby) 21 | ;; (require 'prelude-scala) 22 | (require 'prelude-scheme) 23 | ;; (require 'prelude-scss) 24 | (require 'prelude-xml) 25 | -------------------------------------------------------------------------------- /modules/prelude-scheme.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-scheme.el --- Emacs Prelude: Some defaults for Scheme. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for Scheme programming. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-lisp) 36 | 37 | (add-hook 'scheme-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook))) 38 | 39 | (provide 'prelude-scheme) 40 | 41 | ;;; prelude-scheme.el ends here 42 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | If you discover issues, have ideas for improvements or new features, or 4 | want to contribute a new module, please report them to the 5 | [issue tracker][1] of the repository or submit a pull request. Please, 6 | try to follow these guidelines when you do so. 7 | 8 | ## Issue reporting 9 | 10 | * Check that the issue has not already been reported. 11 | * Check that the issue has not already been fixed in the latest code 12 | (a.k.a. `master`). 13 | * Be clear, concise and precise in your description of the problem. 14 | * Open an issue with a descriptive title and a summary in grammatically correct, 15 | complete sentences. 16 | * Include any relevant code to the issue summary. 17 | 18 | ## Pull requests 19 | 20 | * Read [how to properly contribute to open source projects on Github][2]. 21 | * Use a topic branch to easily amend a pull request later, if necessary. 22 | * Write [good commit messages][3]. 23 | * Use the same coding conventions as the rest of the project. 24 | * Verify your Emacs Lisp code with `checkdoc` (C-c ? d). 25 | * Open a [pull request][4] that relates to *only* one subject with a clear title 26 | and description in grammatically correct, complete sentences. 27 | 28 | [1]: https://github.com/bbatsov/prelude/issues 29 | [2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request 30 | [3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html 31 | [4]: https://help.github.com/articles/using-pull-requests 32 | -------------------------------------------------------------------------------- /modules/prelude-scala.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-scala.el --- Emacs Prelude: scala-mode configuration. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic support for the Scala programming language 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-programming) 36 | (prelude-ensure-module-deps '(scala-mode2)) 37 | 38 | (defun prelude-scala-mode-defaults () 39 | (subword-mode +1)) 40 | 41 | (setq prelude-scala-mode-hook 'prelude-scala-mode-defaults) 42 | 43 | (add-hook 'scala-mode-hook (lambda () 44 | (run-hooks 'prelude-scala-mode-hook))) 45 | (provide 'prelude-scala) 46 | 47 | ;;; prelude-scala.el ends here 48 | -------------------------------------------------------------------------------- /modules/prelude-js.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-js.el --- Emacs Prelude: js-mode configuration. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for js-mode. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-programming) 36 | 37 | (eval-after-load 'js-mode 38 | '(progn 39 | (defun prelude-js-mode-defaults () 40 | ;; electric-layout-mode doesn't play nice with js-mode 41 | (electric-layout-mode -1)) 42 | 43 | (setq prelude-js-mode-hook 'prelude-js-mode-defaults) 44 | 45 | (add-hook 'js-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook))))) 46 | 47 | (provide 'prelude-js) 48 | 49 | ;;; prelude-js.el ends here 50 | -------------------------------------------------------------------------------- /modules/prelude-scss.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-scss.el --- Emacs Prelude: scss support 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: http://www.batsov.com/emacs-prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for scss-mode. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-css) 36 | (prelude-ensure-module-deps '(scss-mode)) 37 | 38 | (defun prelude-scss-mode-defaults () 39 | (prelude-css-mode-defaults) 40 | ;; turn off annoying auto-compile on save 41 | (setq scss-compile-at-save nil)) 42 | 43 | (setq prelude-scss-mode-hook 'prelude-scss-mode-defaults) 44 | 45 | (add-hook 'scss-mode-hook (lambda () (run-hooks 'prelude-scss-mode-hook))) 46 | 47 | (provide 'prelude-scss) 48 | ;;; prelude-scss.el ends here 49 | -------------------------------------------------------------------------------- /modules/prelude-css.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-css.el --- Emacs Prelude: css support 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: http://www.batsov.com/emacs-prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for css-mode. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (eval-after-load 'css-mode 36 | '(progn 37 | (prelude-ensure-module-deps '(rainbow-mode)) 38 | 39 | (defun prelude-css-mode-defaults () 40 | (setq css-indent-offset 2) 41 | (rainbow-mode +1)) 42 | 43 | (setq prelude-css-mode-hook 'prelude-css-mode-defaults) 44 | 45 | (add-hook 'css-mode-hook (lambda () 46 | (run-hooks 'prelude-css-mode-hook))))) 47 | 48 | (provide 'prelude-css) 49 | ;;; prelude-css.el ends here 50 | -------------------------------------------------------------------------------- /modules/prelude-xml.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-xml.el --- Emacs Prelude: XML editing configuration. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic nxml-mode configuration. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'nxml-mode) 36 | 37 | (push '("<\\?xml" . nxml-mode) magic-mode-alist) 38 | 39 | ;; pom files should be treated as xml files 40 | (add-to-list 'auto-mode-alist '("\\.pom$" . nxml-mode)) 41 | 42 | (setq nxml-child-indent 4) 43 | (setq nxml-attribute-indent 4) 44 | (setq nxml-auto-insert-xml-declaration-flag nil) 45 | (setq nxml-bind-meta-tab-to-complete-flag t) 46 | (setq nxml-slash-auto-complete-flag t) 47 | 48 | (provide 'prelude-xml) 49 | 50 | ;;; prelude-xml.el ends here 51 | -------------------------------------------------------------------------------- /modules/prelude-org.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-org.el --- Emacs Prelude: org-mode configuration. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for org-mode. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (add-to-list 'auto-mode-alist '("\\.org\\’" . org-mode)) 36 | (global-set-key "\C-cl" 'org-store-link) 37 | (global-set-key "\C-ca" 'org-agenda) 38 | (global-set-key "\C-cb" 'org-iswitchb) 39 | (setq org-log-done t) 40 | 41 | ;; (defun prelude-org-mode-defaults () 42 | ;; ) 43 | 44 | ;; (setq prelude-org-mode-hook 'prelude-org-mode-defaults) 45 | 46 | ;; (add-hook 'org-mode-hook (lambda () (run-hooks 'prelude-org-mode-hook))) 47 | 48 | (provide 'prelude-org) 49 | 50 | ;;; prelude-org.el ends here 51 | -------------------------------------------------------------------------------- /modules/prelude-python.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-python.el --- Emacs Prelude: python.el configuration. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for python.el (the latest and greatest 15 | ;; Python mode Emacs has to offer). 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (require 'prelude-programming) 37 | 38 | (defun prelude-python-mode-defaults () 39 | "Defaults for Python programming." 40 | (subword-mode +1) 41 | (electric-indent-mode -1)) 42 | 43 | (setq prelude-python-mode-hook 'prelude-python-mode-defaults) 44 | 45 | (add-hook 'python-mode-hook (lambda () 46 | (run-hooks 'prelude-python-mode-hook))) 47 | (provide 'prelude-python) 48 | 49 | ;;; prelude-python.el ends here 50 | -------------------------------------------------------------------------------- /modules/prelude-mediawiki.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-mediawiki.el --- Emacs Prelude: mediawiki editing config 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Basic configs for access to WikEmacs and Wikipedia. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (prelude-ensure-module-deps '(mediawiki)) 36 | 37 | (eval-after-load 'mediawiki 38 | '(progn 39 | (setq mediawiki-site-alist '(("Wikipedia" "http://en.wikipedia.org/w" "" "" "Main Page") 40 | ("WikEmacs" "http://wikemacs.org/w/" "" "" "Main Page"))) 41 | 42 | ;; Emacs users care more for WikEmacs than Wikipedia :-) 43 | (setq mediawiki-site-default "WikEmacs"))) 44 | 45 | (provide 'prelude-mediawiki) 46 | 47 | ;;; prelude-mediawiki.el ends here 48 | -------------------------------------------------------------------------------- /modules/prelude-haskell.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-haskell.el --- Emacs Prelude: Nice config for Haskell programming. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Nice config for Haskell programming. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-programming) 36 | (prelude-ensure-module-deps '(haskell-mode)) 37 | 38 | (eval-after-load 'haskell-mode 39 | '(progn 40 | (defun prelude-haskell-mode-defaults () 41 | (subword-mode +1) 42 | (turn-on-haskell-doc-mode) 43 | (turn-on-haskell-indentation)) 44 | 45 | (setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults) 46 | 47 | (add-hook 'haskell-mode-hook (lambda () 48 | (run-hooks 'prelude-haskell-mode-hook))))) 49 | 50 | (provide 'prelude-haskell) 51 | 52 | ;;; prelude-haskell.el ends here 53 | -------------------------------------------------------------------------------- /modules/prelude-erlang.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-erlang.el --- Emacs Prelude: Erlang programming support. 2 | ;; 3 | ;; Copyright © 2011-2013 Gleb Peregud 4 | ;; 5 | ;; Author: Gleb Peregud 6 | ;; Version: 1.0.0 7 | ;; Keywords: convenience erlang 8 | 9 | ;; This file is not part of GNU Emacs. 10 | 11 | ;;; Commentary: 12 | 13 | ;; Erlang is a concurrent functional language. 14 | 15 | ;;; License: 16 | 17 | ;; This program is free software; you can redistribute it and/or 18 | ;; modify it under the terms of the GNU General Public License 19 | ;; as published by the Free Software Foundation; either version 3 20 | ;; of the License, or (at your option) any later version. 21 | ;; 22 | ;; This program is distributed in the hope that it will be useful, 23 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | ;; GNU General Public License for more details. 26 | ;; 27 | ;; You should have received a copy of the GNU General Public License 28 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 29 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 30 | ;; Boston, MA 02110-1301, USA. 31 | 32 | ;;; Code: 33 | 34 | (require 'prelude-programming) 35 | (prelude-ensure-module-deps '(erlang)) 36 | 37 | (defcustom wrangler-path nil 38 | "The location of wrangler elisp directory." 39 | :group 'prelude-erlang 40 | :type 'string 41 | :safe 'stringp) 42 | 43 | (require 'projectile) 44 | 45 | (when (require 'erlang-start nil t) 46 | 47 | (eval-after-load 'erlang-mode 48 | '(progn 49 | (flymake-mode))) 50 | 51 | (when (not (null wrangler-path)) 52 | (add-to-list 'load-path wrangler-path) 53 | (require 'wrangler))) 54 | 55 | (add-hook 'erlang-mode-hook (lambda () 56 | (setq erlang-compile-function 'projectile-compile-project))) 57 | 58 | (provide 'prelude-erlang) 59 | 60 | ;;; prelude-erlang.el ends here 61 | -------------------------------------------------------------------------------- /modules/prelude-lisp.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-lisp.el --- Emacs Prelude: Configuration common to all lisp modes. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Configuration shared between all modes related to lisp-like languages. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-programming) 36 | (prelude-ensure-module-deps '(rainbow-delimiters)) 37 | 38 | ;; Lisp configuration 39 | (define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) 40 | 41 | ;; a great lisp coding hook 42 | (defun prelude-lisp-coding-defaults () 43 | (rainbow-delimiters-mode +1)) 44 | 45 | (setq prelude-lisp-coding-hook 'prelude-lisp-coding-defaults) 46 | 47 | ;; interactive modes don't need whitespace checks 48 | (defun prelude-interactive-lisp-coding-defaults () 49 | (rainbow-delimiters-mode +1) 50 | (whitespace-mode -1)) 51 | 52 | (setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults) 53 | 54 | (provide 'prelude-lisp) 55 | 56 | ;;; prelude-lisp.el ends here 57 | -------------------------------------------------------------------------------- /modules/prelude-c.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-c.el --- Emacs Prelude: cc-mode configuration. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for cc-mode and the modes derived from it. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-programming) 36 | 37 | (defun prelude-c-mode-common-defaults () 38 | (setq indent-tabs-mode t) 39 | (setq c-basic-offset 4)) 40 | 41 | (setq prelude-c-mode-common-hook 'prelude-c-mode-common-defaults) 42 | 43 | ;; this will affect all modes derived from cc-mode, like 44 | ;; java-mode, php-mode, etc 45 | (add-hook 'c-mode-common-hook (lambda () 46 | (run-hooks 'prelude-c-mode-common-hook))) 47 | 48 | (defun prelude-makefile-mode-defaults () 49 | (setq indent-tabs-mode t)) 50 | 51 | (setq prelude-makefile-mode-hook 'prelude-makefile-mode-defaults) 52 | 53 | (add-hook 'makefile-mode-hook (lambda () 54 | (run-hooks 'prelude-makefile-mode-hook))) 55 | (provide 'prelude-c) 56 | 57 | ;;; prelude-c.el ends here 58 | -------------------------------------------------------------------------------- /modules/prelude-latex.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-latex.el --- Emacs Prelude: Sane setup for LaTeX writers. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Nice defaults for the premium LaTeX editing mode auctex. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (prelude-ensure-module-deps '(auctex)) 36 | 37 | ;; AUCTeX configuration 38 | (setq TeX-auto-save t) 39 | (setq TeX-parse-self t) 40 | 41 | (setq-default TeX-master nil) 42 | 43 | ;; use pdflatex 44 | (setq TeX-PDF-mode t) 45 | 46 | (setq TeX-view-program-selection 47 | '((output-dvi "DVI Viewer") 48 | (output-pdf "PDF Viewer") 49 | (output-html "HTML Viewer"))) 50 | 51 | ;; this section is good for OS X only 52 | ;; TODO add sensible defaults for Linux/Windows 53 | (setq TeX-view-program-list 54 | '(("DVI Viewer" "open %o") 55 | ("PDF Viewer" "open %o") 56 | ("HTML Viewer" "open %o"))) 57 | 58 | (defun prelude-latex-mode-defaults () 59 | (turn-on-auto-fill) 60 | (abbrev-mode +1)) 61 | 62 | (setq prelude-latex-mode-hook 'prelude-latex-mode-defaults) 63 | 64 | (add-hook 'LaTeX-mode-hook (lambda () 65 | (run-hooks 'prelude-latex-mode-hook))) 66 | 67 | (provide 'prelude-latex) 68 | 69 | ;;; prelude-latex.el ends here 70 | -------------------------------------------------------------------------------- /modules/prelude-clojure.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-clojure.el --- Emacs Prelude: Clojure programming configuration. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: http://batsov.com/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for clojure-mode. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-lisp) 36 | (prelude-ensure-module-deps '(clojure-mode clojure-test-mode nrepl)) 37 | 38 | (eval-after-load 'clojure-mode 39 | '(progn 40 | (defun prelude-clojure-mode-defaults () 41 | (subword-mode +1) 42 | (clojure-test-mode +1) 43 | (run-hooks 'prelude-lisp-coding-hook)) 44 | 45 | (setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults) 46 | 47 | (add-hook 'clojure-mode-hook (lambda () 48 | (run-hooks 'prelude-clojure-mode-hook))))) 49 | 50 | (eval-after-load 'nrepl 51 | '(progn 52 | (add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode) 53 | 54 | (defun prelude-nrepl-mode-defaults () 55 | (subword-mode +1) 56 | (run-hooks 'prelude-interactive-lisp-coding-hook)) 57 | 58 | (setq prelude-nrepl-mode-hook 'prelude-nrepl-mode-defaults) 59 | 60 | (add-hook 'nrepl-mode-hook (lambda () 61 | (run-hooks 'prelude-nrepl-mode-hook))))) 62 | 63 | (provide 'prelude-clojure) 64 | 65 | ;;; prelude-clojure.el ends here 66 | -------------------------------------------------------------------------------- /core/prelude-osx.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-osx.el --- Emacs Prelude: OSX specific settings. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some OSX specific stuff. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | ;; On OS X Emacs doesn't use the shell PATH if it's not started from 36 | ;; the shell. Let's fix that: 37 | (prelude-ensure-module-deps '(exec-path-from-shell)) 38 | (require 'exec-path-from-shell) 39 | (exec-path-from-shell-initialize) 40 | 41 | ;; It's all in the Meta 42 | (setq mac-command-modifier 'meta) 43 | (setq mac-option-modifier 'super) 44 | (setq ns-function-modifier 'hyper) 45 | 46 | (defun prelude-swap-meta-and-super () 47 | "Swap the mapping of Meta and Super. 48 | Very useful for people using their Mac with a 49 | Windows external keyboard from time to time." 50 | (interactive) 51 | (if (eq mac-command-modifier 'super) 52 | (progn 53 | (setq mac-command-modifier 'meta) 54 | (setq mac-option-modifier 'super) 55 | (message "Command is now bound to META and Option is bound to SUPER.")) 56 | (progn 57 | (setq mac-command-modifier 'super) 58 | (setq mac-option-modifier 'meta) 59 | (message "Command is now bound to SUPER and Option is bound to META.")))) 60 | 61 | (define-key prelude-mode-map (kbd "C-c w") 'prelude-swap-meta-and-super) 62 | 63 | (menu-bar-mode +1) 64 | 65 | (provide 'prelude-osx) 66 | ;;; prelude-osx.el ends here 67 | -------------------------------------------------------------------------------- /modules/prelude-perl.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-perl.el --- Emacs Prelude: decent Perl coding settings. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; cperl-mode is the best Perl mode for Emacs out there. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-programming) 36 | 37 | ;; use cperl-mode instead of perl-mode 38 | (defalias 'perl-mode 'cperl-mode) 39 | 40 | (define-key 'help-command "P" 'cperl-perldoc) 41 | 42 | (defun prelude-cperl-mode-defaults () 43 | (setq cperl-indent-level 4) 44 | (setq cperl-continued-statement-offset 8) 45 | ;; cperl-hairy affects all those variables, but I prefer 46 | ;; a more fine-grained approach as far as they are concerned 47 | (setq cperl-font-lock t) 48 | (setq cperl-electric-lbrace-space t) 49 | (setq cperl-electric-parens nil) 50 | (setq cperl-electric-linefeed nil) 51 | (setq cperl-electric-keywords nil) 52 | (setq cperl-info-on-command-no-prompt t) 53 | (setq cperl-clobber-lisp-bindings t) 54 | (setq cperl-lazy-help-time 3) 55 | 56 | ;; if you want all the bells and whistles 57 | ;; (setq cperl-hairy) 58 | 59 | (set-face-background 'cperl-array-face nil) 60 | (set-face-background 'cperl-hash-face nil) 61 | (setq cperl-invalid-face nil)) 62 | 63 | (setq prelude-cperl-mode-hook 'prelude-cperl-mode-defaults) 64 | 65 | (add-hook 'cperl-mode-hook (lambda () 66 | (run-hooks 'prelude-cperl-mode-hook)) t) 67 | 68 | (provide 'prelude-perl) 69 | 70 | ;;; prelude-perl.el ends here 71 | -------------------------------------------------------------------------------- /modules/prelude-coffee.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-coffee.el --- Emacs Prelude: CoffeeScript programming support. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; CoffeeScript is a nice little language that comples to JavaScript. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-programming) 36 | 37 | (eval-after-load 'coffee-mode 38 | '(progn 39 | (defun prelude-coffee-mode-defaults () 40 | "coffee-mode-defaults" 41 | 42 | ;; CoffeeScript uses two spaces. 43 | (set (make-local-variable 'tab-width) 2) 44 | 45 | ;; If you don't have js2-mode 46 | (setq coffee-js-mode 'javascript-mode) 47 | 48 | ;; If you don't want your compiled files to be wrapped 49 | (setq coffee-args-compile '("-c" "--bare")) 50 | 51 | ;; *Messages* spam 52 | (setq coffee-debug-mode t) 53 | 54 | ;; Emacs key binding 55 | (define-key coffee-mode-map [(meta r)] 'coffee-compile-buffer) 56 | 57 | ;; Riding edge. 58 | (setq coffee-command "~/dev/coffee") 59 | 60 | ;; Compile '.coffee' files on every save 61 | (and (file-exists-p (buffer-file-name)) 62 | (file-exists-p (coffee-compiled-file-name)) 63 | (coffee-cos-mode t))) 64 | 65 | (setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults) 66 | 67 | (add-hook 'coffee-mode-hook (lambda () 68 | (run-hooks 'prelude-coffee-mode-hook))))) 69 | (provide 'prelude-coffee) 70 | 71 | ;;; prelude-coffee.el ends here 72 | -------------------------------------------------------------------------------- /core/prelude-ui.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-ui.el --- Emacs Prelude: UI optimizations and tweaks. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; We dispense with most of the point and click UI, reduce the startup noise, 15 | ;; configure smooth scolling and a nice theme that's easy on the eyes (zenburn). 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | ;; the toolbar is just a waste of valuable screen estate 37 | ;; in a tty tool-bar-mode does not properly auto-load, and is 38 | ;; already disabled anyway 39 | (when (fboundp 'tool-bar-mode) 40 | (tool-bar-mode -1)) 41 | 42 | (menu-bar-mode -1) 43 | 44 | ;; the blinking cursor is nothing, but an annoyance 45 | (blink-cursor-mode -1) 46 | 47 | ;; disable startup screen 48 | (setq inhibit-startup-screen t) 49 | 50 | ;; nice scrolling 51 | (setq scroll-margin 0 52 | scroll-conservatively 100000 53 | scroll-preserve-screen-position 1) 54 | 55 | ;; mode line settings 56 | (line-number-mode t) 57 | (column-number-mode t) 58 | (size-indication-mode t) 59 | 60 | ;; make the fringe (gutter) smaller 61 | ;; the argument is a width in pixels (the default is 8) 62 | (if (fboundp 'fringe-mode) 63 | (fringe-mode 4)) 64 | 65 | ;; enable y/n answers 66 | (fset 'yes-or-no-p 'y-or-n-p) 67 | 68 | ;; more useful frame title, that show either a file or a 69 | ;; buffer name (if the buffer isn't visiting a file) 70 | (setq frame-title-format 71 | '("" invocation-name " Prelude - " (:eval (if (buffer-file-name) 72 | (abbreviate-file-name (buffer-file-name)) 73 | "%b")))) 74 | 75 | ;; use zenburn as the default theme 76 | (load-theme 'zenburn t) 77 | 78 | (provide 'prelude-ui) 79 | ;;; prelude-ui.el ends here 80 | -------------------------------------------------------------------------------- /modules/prelude-ruby.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for Ruby and Rails development. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-programming) 36 | (require 'smartparens-ruby) 37 | 38 | (prelude-ensure-module-deps '(ruby-tools inf-ruby yari)) 39 | 40 | ;; Rake files are ruby, too, as are gemspecs, rackup files, and gemfiles. 41 | (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode)) 42 | (add-to-list 'auto-mode-alist '("Rakefile\\'" . ruby-mode)) 43 | (add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode)) 44 | (add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode)) 45 | (add-to-list 'auto-mode-alist '("Gemfile\\'" . ruby-mode)) 46 | (add-to-list 'auto-mode-alist '("Guardfile\\'" . ruby-mode)) 47 | (add-to-list 'auto-mode-alist '("Capfile\\'" . ruby-mode)) 48 | (add-to-list 'auto-mode-alist '("\\.thor\\'" . ruby-mode)) 49 | (add-to-list 'auto-mode-alist '("Thorfile\\'" . ruby-mode)) 50 | (add-to-list 'auto-mode-alist '("Vagrantfile\\'" . ruby-mode)) 51 | (add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . ruby-mode)) 52 | 53 | ;; We never want to edit Rubinius bytecode 54 | (add-to-list 'completion-ignored-extensions ".rbc") 55 | 56 | (define-key 'help-command (kbd "R") 'yari) 57 | 58 | (eval-after-load 'ruby-mode 59 | '(progn 60 | (defun prelude-ruby-mode-defaults () 61 | (inf-ruby-setup-keybindings) 62 | ;; turn off the annoying input echo in irb 63 | (setq comint-process-echoes t) 64 | (ruby-tools-mode +1) 65 | ;; CamelCase aware editing operations 66 | (subword-mode +1)) 67 | 68 | (setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults) 69 | 70 | (add-hook 'ruby-mode-hook (lambda () 71 | (run-hooks 'prelude-ruby-mode-hook))))) 72 | 73 | (provide 'prelude-ruby) 74 | ;;; prelude-ruby.el ends here 75 | -------------------------------------------------------------------------------- /modules/prelude-emacs-lisp.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-emacs-lisp.el --- Emacs Prelude: Nice config for Elisp programming. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | ;; Package-Requires: ((prelude-lisp "1.0.0")) 10 | 11 | ;; This file is not part of GNU Emacs. 12 | 13 | ;;; Commentary: 14 | 15 | ;; Nice config for Elisp Programming. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (require 'prelude-lisp) 37 | 38 | (defun prelude-remove-elc-on-save () 39 | "If you're saving an elisp file, likely the .elc is no longer valid." 40 | (add-hook 'after-save-hook 41 | (lambda () 42 | (if (file-exists-p (concat buffer-file-name "c")) 43 | (delete-file (concat buffer-file-name "c")))) 44 | nil 45 | t)) 46 | 47 | (defun prelude-visit-ielm () 48 | "Switch to default `ielm' buffer. 49 | Start `ielm' if it's not already running." 50 | (interactive) 51 | (prelude-start-or-switch-to 'ielm "*ielm*")) 52 | 53 | (define-key emacs-lisp-mode-map (kbd "C-c C-z") 'prelude-visit-ielm) 54 | 55 | (defun prelude-conditional-emacs-lisp-checker () 56 | "Don't check doc style in Emacs Lisp test files." 57 | (let ((file-name (buffer-file-name))) 58 | (when (and file-name (string-match-p ".*-tests?\\.el\\'" file-name)) 59 | (setq-local flycheck-checkers '(emacs-lisp))))) 60 | 61 | (defun prelude-emacs-lisp-mode-defaults () 62 | "Sensible defaults for `emacs-lisp-mode'." 63 | (run-hooks 'prelude-lisp-coding-hook) 64 | (turn-on-eldoc-mode) 65 | (prelude-remove-elc-on-save) 66 | (rainbow-mode +1) 67 | (setq mode-name "EL") 68 | (prelude-conditional-emacs-lisp-checker)) 69 | 70 | (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults) 71 | 72 | (add-hook 'emacs-lisp-mode-hook (lambda () 73 | (run-hooks 'prelude-emacs-lisp-mode-hook))) 74 | 75 | ;; ielm is an interactive Emacs Lisp shell 76 | (defun prelude-ielm-mode-defaults () 77 | "Sensible defaults for `ielm'." 78 | (run-hooks 'prelude-interactive-lisp-coding-hook) 79 | (turn-on-eldoc-mode)) 80 | 81 | (setq prelude-ielm-mode-hook 'prelude-ielm-mode-defaults) 82 | 83 | (add-hook 'ielm-mode-hook (lambda () 84 | (run-hooks 'prelude-ielm-mode-hook))) 85 | 86 | (eval-after-load "elisp-slime-nav" 87 | '(diminish 'elisp-slime-nav-mode)) 88 | (eval-after-load "rainbow-mode" 89 | '(diminish 'rainbow-mode)) 90 | (eval-after-load "eldoc" 91 | '(diminish 'eldoc-mode)) 92 | 93 | ;; enable elisp-slime-nav-mode 94 | (dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook)) 95 | (add-hook hook 'elisp-slime-nav-mode)) 96 | 97 | (provide 'prelude-emacs-lisp) 98 | 99 | ;;; prelude-emacs-lisp.el ends here 100 | -------------------------------------------------------------------------------- /modules/prelude-common-lisp.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Configuration for lisp-mode and SLIME. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'prelude-lisp) 36 | 37 | ;; the SBCL configuration file is in Common Lisp 38 | (add-to-list 'auto-mode-alist '("\\.sbclrc$" . lisp-mode)) 39 | 40 | ;; Common Lisp support depends on SLIME being installed with Quicklisp 41 | (if (file-exists-p (expand-file-name "~/quicklisp/slime-helper.el")) 42 | (load (expand-file-name "~/quicklisp/slime-helper.el")) 43 | (message "%s" "SLIME is not installed. Use Quicklisp to install it.")) 44 | 45 | ;; a list of alternative Common Lisp implementations that can be 46 | ;; used with SLIME. Note that their presence render 47 | ;; inferior-lisp-program useless. This variable holds a list of 48 | ;; programs and if you invoke SLIME with a negative prefix 49 | ;; argument, M-- M-x slime, you can select a program from that list. 50 | (setq slime-lisp-implementations 51 | '((ccl ("ccl")) 52 | (clisp ("clisp" "-q")) 53 | (cmucl ("cmucl" "-quiet")) 54 | (sbcl ("sbcl" "--noinform") :coding-system utf-8-unix))) 55 | 56 | ;; select the default value from slime-lisp-implementations 57 | (if (eq system-type 'darwin) 58 | ;; default to Clozure CL on OS X 59 | (setq slime-default-lisp 'ccl) 60 | ;; default to SBCL on Linux and Windows 61 | (setq slime-default-lisp 'sbcl)) 62 | 63 | (add-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook))) 64 | (add-hook 'slime-repl-mode-hook (lambda () (run-hooks 'prelude-interactive-lisp-coding-hook))) 65 | 66 | ;; start slime automatically when we open a lisp file 67 | (defun prelude-start-slime () 68 | (unless (slime-connected-p) 69 | (save-excursion (slime)))) 70 | 71 | (add-hook 'slime-mode-hook 'prelude-start-slime) 72 | 73 | ;; Stop SLIME's REPL from grabbing DEL, 74 | ;; which is annoying when backspacing over a '(' 75 | (defun prelude-override-slime-repl-bindings-with-paredit () 76 | (define-key slime-repl-mode-map 77 | (read-kbd-macro paredit-backward-delete-key) nil)) 78 | 79 | (add-hook 'slime-repl-mode-hook 'prelude-override-slime-repl-bindings-with-paredit) 80 | 81 | (eval-after-load "slime" 82 | '(progn 83 | (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol 84 | slime-fuzzy-completion-in-place t 85 | slime-enable-evaluate-in-emacs t 86 | slime-autodoc-use-multiline-p t) 87 | 88 | (define-key slime-mode-map (kbd "TAB") 'slime-indent-and-complete-symbol) 89 | (define-key slime-mode-map (kbd "C-c i") 'slime-inspect) 90 | (define-key slime-mode-map (kbd "C-c C-s") 'slime-selector))) 91 | 92 | (provide 'prelude-common-lisp) 93 | 94 | ;;; prelude-common-lisp.el ends here 95 | -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | ;;; init.el --- Prelude's configuration entry point. 2 | ;; 3 | ;; Copyright (c) 2011 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: http://batsov.com/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; This file simply sets up the default load path and requires 15 | ;; the various modules defined within Emacs Prelude. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (message "Prelude is powering up... Be patient, Master %s!" (getenv "USER")) 37 | 38 | (defvar prelude-dir (file-name-directory load-file-name) 39 | "The root dir of the Emacs Prelude distribution.") 40 | (defvar prelude-core-dir (expand-file-name "core" prelude-dir) 41 | "The home of Prelude's core functionality.") 42 | (defvar prelude-modules-dir (expand-file-name "modules" prelude-dir) 43 | "This directory houses all of the built-in Prelude modules.") 44 | (defvar prelude-personal-dir (expand-file-name "personal" prelude-dir) 45 | "This directory is for your personal configuration. 46 | 47 | Users of Emacs Prelude are encouraged to keep their personal configuration 48 | changes in this directory. All Emacs Lisp files there are loaded automatically 49 | by Prelude.") 50 | (defvar prelude-vendor-dir (expand-file-name "vendor" prelude-dir) 51 | "This directory houses packages that are not yet available in ELPA (or MELPA).") 52 | (defvar prelude-savefile-dir (expand-file-name "savefile" prelude-dir) 53 | "This folder stores all the automatically generated save/history-files.") 54 | (defvar prelude-modules-file (expand-file-name "prelude-modules.el" prelude-dir) 55 | "This files contains a list of modules that will be loaded by Prelude.") 56 | 57 | (unless (file-exists-p prelude-savefile-dir) 58 | (make-directory prelude-savefile-dir)) 59 | 60 | (defun prelude-add-subfolders-to-load-path (parent-dir) 61 | "Add all first level PARENT-DIR subdirs to the `load-path'." 62 | (dolist (f (directory-files parent-dir)) 63 | (let ((name (expand-file-name f parent-dir))) 64 | (when (and (file-directory-p name) 65 | (not (equal f "..")) 66 | (not (equal f "."))) 67 | (add-to-list 'load-path name))))) 68 | 69 | ;; add Prelude's directories to Emacs's `load-path' 70 | (add-to-list 'load-path prelude-core-dir) 71 | (add-to-list 'load-path prelude-modules-dir) 72 | (add-to-list 'load-path prelude-vendor-dir) 73 | (prelude-add-subfolders-to-load-path prelude-vendor-dir) 74 | 75 | ;; the core stuff 76 | (require 'prelude-packages) 77 | (require 'prelude-ui) 78 | (require 'prelude-core) 79 | (require 'prelude-mode) 80 | (require 'prelude-editor) 81 | (require 'prelude-global-keybindings) 82 | 83 | ;; OSX specific settings 84 | (when (eq system-type 'darwin) 85 | (require 'prelude-osx)) 86 | 87 | ;; the modules 88 | (when (file-exists-p prelude-modules-file) 89 | (load prelude-modules-file)) 90 | 91 | ;; config changes made through the customize UI will be store here 92 | (setq custom-file (expand-file-name "custom.el" prelude-personal-dir)) 93 | 94 | ;; load the personal settings (this includes `custom-file') 95 | (when (file-exists-p prelude-personal-dir) 96 | (message "Loading personal configuration files in %s..." prelude-personal-dir) 97 | (mapc 'load (directory-files prelude-personal-dir 't "^[^#].*el$"))) 98 | 99 | (message "Prelude is ready to do thy bidding, Master %s!" (getenv "USER")) 100 | 101 | (prelude-eval-after-init 102 | ;; greet the use with some useful tip 103 | (run-at-time 5 nil 'prelude-tip-of-the-day)) 104 | 105 | ;;; init.el ends here 106 | -------------------------------------------------------------------------------- /core/prelude-global-keybindings.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Lots of useful keybindings. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | ;; Align your code in a pretty way. 36 | (global-set-key (kbd "C-x \\") 'align-regexp) 37 | 38 | ;; Font size 39 | (global-set-key (kbd "C-+") 'text-scale-increase) 40 | (global-set-key (kbd "C--") 'text-scale-decrease) 41 | 42 | ;; Window switching. (C-x o goes to the next window) 43 | (global-set-key (kbd "C-x O") (lambda () 44 | (interactive) 45 | (other-window -1))) ;; back one 46 | 47 | ;; Indentation help 48 | (global-set-key (kbd "C-^") 'prelude-top-join-line) 49 | 50 | ;; Start proced in a similar manner to dired 51 | (global-set-key (kbd "C-x p") 'proced) 52 | 53 | ;; Start eshell or switch to it if it's active. 54 | (global-set-key (kbd "C-x m") 'eshell) 55 | 56 | ;; Start a new eshell even if one is active. 57 | (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) 58 | 59 | ;; Start a regular shell if you prefer that. 60 | (global-set-key (kbd "C-x M-m") 'shell) 61 | 62 | ;; If you want to be able to M-x without meta 63 | (global-set-key (kbd "C-x C-m") 'execute-extended-command) 64 | 65 | ;; A complementary binding to the apropos-command (C-h a) 66 | (define-key 'help-command "A" 'apropos) 67 | 68 | (global-set-key (kbd "C-h C-f") 'find-function) 69 | (global-set-key (kbd "C-h C-k") 'find-function-on-key) 70 | (global-set-key (kbd "C-h C-v") 'find-variable) 71 | (global-set-key (kbd "C-h C-l") 'find-library) 72 | 73 | ;; a complement to the zap-to-char command, that doesn't eat up the target character 74 | (autoload 'zap-up-to-char "misc" "Kill up to, but not including ARGth occurrence of CHAR.") 75 | (global-set-key (kbd "M-Z") 'zap-up-to-char) 76 | 77 | ;; kill lines backward 78 | (global-set-key (kbd "C-") (lambda () 79 | (interactive) 80 | (kill-line 0) 81 | (indent-according-to-mode))) 82 | 83 | (global-set-key [remap kill-whole-line] 'prelude-kill-whole-line) 84 | 85 | ;; Activate occur easily inside isearch 86 | (define-key isearch-mode-map (kbd "C-o") 87 | (lambda () (interactive) 88 | (let ((case-fold-search isearch-case-fold-search)) 89 | (occur (if isearch-regexp 90 | isearch-string 91 | (regexp-quote isearch-string)))))) 92 | 93 | ;; use hippie-expand instead of dabbrev 94 | (global-set-key (kbd "M-/") 'hippie-expand) 95 | 96 | ;; replace buffer-menu with ibuffer 97 | (global-set-key (kbd "C-x C-b") 'ibuffer) 98 | 99 | ;; toggle menu-bar visibility 100 | (global-set-key (kbd "") 'menu-bar-mode) 101 | 102 | (global-set-key (kbd "C-x g") 'magit-status) 103 | 104 | (global-set-key (kbd "C-=") 'er/expand-region) 105 | 106 | ;; make C-x C-x usable with transient-mark-mode 107 | (define-key global-map 108 | [remap exchange-point-and-mark] 109 | 'prelude-exchange-point-and-mark) 110 | 111 | (global-set-key (kbd "C-c SPC") 'ace-jump-mode) 112 | (global-set-key (kbd "C-x SPC") 'ace-jump-mode-pop-mark) 113 | 114 | ;; key chords 115 | (require 'key-chord) 116 | 117 | (key-chord-define-global "jj" 'ace-jump-word-mode) 118 | (key-chord-define-global "jl" 'ace-jump-line-mode) 119 | (key-chord-define-global "jk" 'ace-jump-char-mode) 120 | (key-chord-define-global "JJ" 'prelude-switch-to-previous-buffer) 121 | (key-chord-define-global "uu" 'undo-tree-visualize) 122 | 123 | (key-chord-mode +1) 124 | 125 | (provide 'prelude-global-keybindings) 126 | 127 | ;;; prelude-global-keybindings.el ends here 128 | -------------------------------------------------------------------------------- /modules/prelude-programming.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-programming.el --- Emacs Prelude: prog-mode configuration 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic prog-mode configuration and programming related utilities. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (prelude-ensure-module-deps '(guru-mode)) 36 | 37 | (defun prelude-ido-goto-symbol (&optional symbol-list) 38 | "Refresh imenu and jump to a place in the buffer using Ido." 39 | (interactive) 40 | (unless (featurep 'imenu) 41 | (require 'imenu nil t)) 42 | (cond 43 | ((not symbol-list) 44 | (let ((ido-mode ido-mode) 45 | (ido-enable-flex-matching 46 | (if (boundp 'ido-enable-flex-matching) 47 | ido-enable-flex-matching t)) 48 | name-and-pos symbol-names position) 49 | (unless ido-mode 50 | (ido-mode 1) 51 | (setq ido-enable-flex-matching t)) 52 | (while (progn 53 | (imenu--cleanup) 54 | (setq imenu--index-alist nil) 55 | (prelude-ido-goto-symbol (imenu--make-index-alist)) 56 | (setq selected-symbol 57 | (ido-completing-read "Symbol? " symbol-names)) 58 | (string= (car imenu--rescan-item) selected-symbol))) 59 | (unless (and (boundp 'mark-active) mark-active) 60 | (push-mark nil t nil)) 61 | (setq position (cdr (assoc selected-symbol name-and-pos))) 62 | (cond 63 | ((overlayp position) 64 | (goto-char (overlay-start position))) 65 | (t 66 | (goto-char position))) 67 | (recenter))) 68 | ((listp symbol-list) 69 | (dolist (symbol symbol-list) 70 | (let (name position) 71 | (cond 72 | ((and (listp symbol) (imenu--subalist-p symbol)) 73 | (prelude-ido-goto-symbol symbol)) 74 | ((listp symbol) 75 | (setq name (car symbol)) 76 | (setq position (cdr symbol))) 77 | ((stringp symbol) 78 | (setq name symbol) 79 | (setq position 80 | (get-text-property 1 'org-imenu-marker symbol)))) 81 | (unless (or (null position) (null name) 82 | (string= (car imenu--rescan-item) name)) 83 | (add-to-list 'symbol-names (substring-no-properties name)) 84 | (add-to-list 'name-and-pos (cons (substring-no-properties name) position)))))))) 85 | 86 | ;; add a shortcut for prelude-ido-goto-symbol 87 | (eval-after-load 'prelude-mode 88 | '(define-key prelude-mode-map (kbd "C-c i") 'prelude-ido-goto-symbol)) 89 | 90 | (defun prelude-local-comment-auto-fill () 91 | (set (make-local-variable 'comment-auto-fill-only-comments) t)) 92 | 93 | (defun prelude-add-watchwords () 94 | (font-lock-add-keywords 95 | nil '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):" 96 | 1 font-lock-warning-face t)))) 97 | 98 | ;; show the name of the current function definition in the modeline 99 | (require 'which-func) 100 | (add-to-list 'which-func-modes 'ruby-mode) 101 | (which-function-mode 1) 102 | 103 | ;; in Emacs 24 programming major modes generally derive from a common 104 | ;; mode named prog-mode; for others, we'll arrange for our mode 105 | ;; defaults function to run prelude-prog-mode-hook directly. To 106 | ;; augment and/or counteract these defaults your own function 107 | ;; to prelude-prog-mode-hook, using: 108 | ;; 109 | ;; (add-hook 'prelude-prog-mode-hook 'my-prog-mode-defaults t) 110 | ;; 111 | ;; (the final optional t sets the *append* argument) 112 | 113 | (defun prelude-prog-mode-defaults () 114 | "Default coding hook, useful with any programming language." 115 | (when (and (executable-find ispell-program-name) 116 | prelude-flyspell) 117 | (flyspell-prog-mode)) 118 | (when prelude-guru 119 | (guru-mode +1)) 120 | (prelude-enable-whitespace) 121 | (prelude-local-comment-auto-fill) 122 | (prelude-add-watchwords)) 123 | 124 | (setq prelude-prog-mode-hook 'prelude-prog-mode-defaults) 125 | 126 | (add-hook 'prog-mode-hook (lambda () 127 | (run-hooks 'prelude-prog-mode-hook))) 128 | 129 | (if (fboundp 'global-flycheck-mode) 130 | (global-flycheck-mode +1) 131 | (add-hook 'prog-mode-hook 'flycheck-mode)) 132 | 133 | (provide 'prelude-programming) 134 | ;;; prelude-programming.el ends here 135 | -------------------------------------------------------------------------------- /core/prelude-packages.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-packages.el --- Emacs Prelude: default package selection. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Takes care of the automatic installation of all the packages required by 15 | ;; Emacs Prelude. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | (require 'cl) 36 | (require 'package) 37 | (add-to-list 'package-archives 38 | '("melpa" . "http://melpa.milkbox.net/packages/") t) 39 | ;; set package-user-dir to be relative to Prelude install path 40 | (setq package-user-dir (expand-file-name "elpa" prelude-dir)) 41 | (package-initialize) 42 | 43 | (defvar prelude-packages 44 | '(ace-jump-mode ack-and-a-half dash diminish elisp-slime-nav 45 | expand-region flycheck gist 46 | git-commit-mode gitconfig-mode gitignore-mode 47 | guru-mode helm helm-projectile ido-ubiquitous 48 | key-chord magit melpa rainbow-mode 49 | smartparens smex solarized-theme undo-tree 50 | volatile-highlights zenburn-theme) 51 | "A list of packages to ensure are installed at launch.") 52 | 53 | (defun prelude-packages-installed-p () 54 | "Check if all packages in `prelude-packages' are installed." 55 | (every #'package-installed-p prelude-packages)) 56 | 57 | (defun prelude-install-packages () 58 | "Install all packages listed in `prelude-packages'." 59 | (unless (prelude-packages-installed-p) 60 | ;; check for new packages (package versions) 61 | (message "%s" "Emacs Prelude is now refreshing its package database...") 62 | (package-refresh-contents) 63 | (message "%s" " done.") 64 | ;; install the missing packages 65 | (mapc #'package-install 66 | (remove-if #'package-installed-p prelude-packages)))) 67 | 68 | (prelude-install-packages) 69 | 70 | (defmacro prelude-auto-install (extension package mode) 71 | "When file with EXTENSION is opened triggers auto-install of PACKAGE. 72 | PACKAGE is installed only if not already present. The file is opened in MODE." 73 | `(add-to-list 'auto-mode-alist 74 | `(,extension . (lambda () 75 | (unless (package-installed-p ',package) 76 | (package-install ',package)) 77 | (,mode))))) 78 | 79 | (defvar prelude-auto-install-alist 80 | '(("\\.clj\\'" clojure-mode clojure-mode) 81 | ("\\.coffee\\'" coffee-mode coffee-mode) 82 | ("\\.css\\'" css-mode css-mode) 83 | ("\\.csv\\'" csv-mode csv-mode) 84 | ("\\.d\\'" d-mode d-mode) 85 | ("\\.dart\\'" dart-mode dart-mode) 86 | ("\\.erl\\'" erlang erlang-mode) 87 | ("\\.feature\\'" feature-mode feature-mode) 88 | ("\\.go\\'" go-mode go-mode) 89 | ("\\.groovy\\'" groovy-mode groovy-mode) 90 | ("\\.haml\\'" haml-mode haml-mode) 91 | ("\\.hs\\'" haskell-mode haskell-mode) 92 | ("\\.latex\\'" auctex LaTeX-mode) 93 | ("\\.less\\'" less-css-mode less-css-mode) 94 | ("\\.lua\\'" lua-mode lua-mode) 95 | ("\\.markdown\\'" markdown-mode markdown-mode) 96 | ("\\.md\\'" markdown-mode markdown-mode) 97 | ("\\.ml\\'" tuareg tuareg-mode) 98 | ("\\.php\\'" php-mode php-mode) 99 | ("PKGBUILD\\'" pkgbuild-mode pkgbuild-mode) 100 | ("\\.sass\\'" sass-mode sass-mode) 101 | ("\\.scala\\'" scala-mode2 scala-mode) 102 | ("\\.scss\\'" scss-mode scss-mode) 103 | ("\\.slim\\'" slim-mode slim-mode) 104 | ("\\.textile\\'" textile-mode textile-mode) 105 | ("\\.yml\\'" yaml-mode yaml-mode))) 106 | 107 | ;; markdown-mode doesn't have autoloads for the auto-mode-alist 108 | ;; so we add them manually if it's already installed 109 | (when (package-installed-p 'markdown-mode) 110 | (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) 111 | (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))) 112 | 113 | (when (package-installed-p 'pkgbuild-mode) 114 | (add-to-list 'auto-mode-alist '("PKGBUILD\\'" . pkgbuild-mode))) 115 | 116 | ;; build auto-install mappings 117 | (mapc 118 | (lambda (entry) 119 | (let ((extension (car entry)) 120 | (package (cadr entry)) 121 | (mode (cadr (cdr entry)))) 122 | (unless (package-installed-p package) 123 | (prelude-auto-install extension package mode)))) 124 | prelude-auto-install-alist) 125 | 126 | (defun prelude-ensure-module-deps (packages) 127 | "Ensure PACKAGES are installed. 128 | Missing packages are installed automatically." 129 | (mapc #'package-install (remove-if #'package-installed-p packages))) 130 | 131 | (provide 'prelude-packages) 132 | ;; Local Variables: 133 | ;; byte-compile-warnings: (not cl-functions) 134 | ;; End: 135 | 136 | ;;; prelude-packages.el ends here 137 | -------------------------------------------------------------------------------- /core/prelude-mode.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-mode.el --- Emacs Prelude: minor mode 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; A minor mode defining a local keymap, plus a menu. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | (require 'easymenu) 35 | 36 | (defvar prelude-mode-map 37 | (let ((map (make-sparse-keymap))) 38 | (define-key map (kbd "C-c o") 'prelude-open-with) 39 | (define-key map (kbd "C-c g") 'prelude-google) 40 | ;; mimic popular IDEs binding, note that it doesn't work in a terminal session 41 | (define-key map [(shift return)] 'prelude-smart-open-line) 42 | (define-key map (kbd "M-o") 'prelude-smart-open-line) 43 | (define-key map [(control shift return)] 'prelude-smart-open-line-above) 44 | (define-key map [(control shift up)] 'prelude-move-line-up) 45 | (define-key map [(control shift down)] 'prelude-move-line-down) 46 | (define-key map [(meta shift up)] 'prelude-move-line-up) 47 | (define-key map [(meta shift down)] 'prelude-move-line-down) 48 | (define-key map (kbd "C-c n") 'prelude-cleanup-buffer) 49 | (define-key map (kbd "C-c f") 'prelude-recentf-ido-find-file) 50 | (define-key map (kbd "C-M-\\") 'prelude-indent-region-or-buffer) 51 | (define-key map (kbd "C-M-z") 'prelude-indent-defun) 52 | (define-key map (kbd "C-c u") 'prelude-view-url) 53 | (define-key map (kbd "C-c e") 'prelude-eval-and-replace) 54 | (define-key map (kbd "C-c s") 'prelude-swap-windows) 55 | (define-key map (kbd "C-c D") 'prelude-delete-file-and-buffer) 56 | (define-key map (kbd "C-c d") 'prelude-duplicate-current-line-or-region) 57 | (define-key map (kbd "C-c r") 'prelude-rename-file-and-buffer) 58 | (define-key map (kbd "C-c t") 'prelude-visit-term-buffer) 59 | (define-key map (kbd "C-c k") 'prelude-kill-other-buffers) 60 | (define-key map (kbd "C-c TAB") 'prelude-indent-rigidly-and-copy-to-clipboard) 61 | (define-key map (kbd "C-c h") 'helm-prelude) 62 | map) 63 | "Keymap for Prelude mode.") 64 | 65 | (defun prelude-mode-add-menu () 66 | "Add a menu entry for `prelude-mode' under Tools." 67 | (easy-menu-add-item nil '("Tools") 68 | '("Prelude" 69 | ("Files" 70 | ["Open with..." prelude-open-with] 71 | ["Delete file and buffer" prelude-delete-file-and-buffer] 72 | ["Rename file and buffer" prelude-rename-file-and-buffer] 73 | ["Copy file name to clipboard" prelude-copy-file-name-to-clipboard]) 74 | 75 | ("Buffers" 76 | ["Clean up buffer" prelude-cleanup-buffer] 77 | ["Kill other buffers" prelude-kill-other-buffers]) 78 | 79 | ("Editing" 80 | ["Insert empty line" prelude-insert-empty-line] 81 | ["Move line up" prelude-move-line-up] 82 | ["Move line down" prelude-move-line-down] 83 | ["Indent buffer" prelude-indent-buffer] 84 | ["Indent buffer or region" prelude-indent-buffer-or-region] 85 | ["Duplicate line or region" prelude-duplicate-current-line-or-region] 86 | ["Indent rigidly and copy to clipboard" prelude-indent-rigidly-and-copy-to-clipboard] 87 | ["Insert date" prelude-insert-date] 88 | ["Eval and replace" prelude-eval-and-replace]) 89 | 90 | ("Navigation" 91 | ["Helm" helm-prelude]) 92 | 93 | ("Windows" 94 | ["Swap windows" prelude-swap-windows]) 95 | 96 | ("General" 97 | ["Visit term buffer" prelude-visit-term-buffer] 98 | ["Search in Google" prelude-google] 99 | ["View URL" prelude-view-url])) 100 | "Search Files (Grep)...") 101 | 102 | (easy-menu-add-item nil '("Tools") '("--") "Search Files (Grep)...")) 103 | 104 | (defun prelude-mode-remove-menu () 105 | "Remove `prelude-mode' menu entry." 106 | (easy-menu-remove-item nil '("Tools") "Prelude") 107 | (easy-menu-remove-item nil '("Tools") "--")) 108 | 109 | ;; define minor mode 110 | (define-minor-mode prelude-mode 111 | "Minor mode to consolidate Emacs Prelude extensions. 112 | 113 | \\{prelude-mode-map}" 114 | :lighter " Pre" 115 | :keymap prelude-mode-map 116 | (if prelude-mode 117 | ;; on start 118 | (prelude-mode-add-menu) 119 | ;; on stop 120 | (prelude-mode-remove-menu))) 121 | 122 | (define-globalized-minor-mode prelude-global-mode prelude-mode prelude-on) 123 | 124 | (defun prelude-on () 125 | "Turn on `prelude-mode'." 126 | (prelude-mode +1)) 127 | 128 | (defun prelude-off () 129 | "Turn off `prelude-mode'." 130 | (prelude-mode -1)) 131 | 132 | (provide 'prelude-mode) 133 | ;;; prelude-mode.el ends here 134 | -------------------------------------------------------------------------------- /modules/prelude-erc.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-erc.el --- Emacs Prelude: ERC mode configuration. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Some basic configuration for ERC mode, which should make your 15 | ;; IRC experience a bit more pleasant. 16 | 17 | ;;; License: 18 | 19 | ;; This program is free software; you can redistribute it and/or 20 | ;; modify it under the terms of the GNU General Public License 21 | ;; as published by the Free Software Foundation; either version 3 22 | ;; of the License, or (at your option) any later version. 23 | ;; 24 | ;; This program is distributed in the hope that it will be useful, 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | ;; GNU General Public License for more details. 28 | ;; 29 | ;; You should have received a copy of the GNU General Public License 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 31 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 32 | ;; Boston, MA 02110-1301, USA. 33 | 34 | ;;; Code: 35 | 36 | (require 'erc) 37 | (require 'erc-log) 38 | (require 'erc-notify) 39 | (require 'erc-spelling) 40 | (require 'erc-autoaway) 41 | 42 | ;; Interpret mIRC-style color commands in IRC chats 43 | (setq erc-interpret-mirc-color t) 44 | 45 | ;; The following are commented out by default, but users of other 46 | ;; non-Emacs IRC clients might find them useful. 47 | ;; Kill buffers for channels after /part 48 | (setq erc-kill-buffer-on-part t) 49 | ;; Kill buffers for private queries after quitting the server 50 | (setq erc-kill-queries-on-quit t) 51 | ;; Kill buffers for server messages after quitting the server 52 | (setq erc-kill-server-buffer-on-quit t) 53 | 54 | ;; open query buffers in the current window 55 | (setq erc-query-display 'buffer) 56 | 57 | ;; exclude boring stuff from tracking 58 | (erc-track-mode t) 59 | (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE" 60 | "324" "329" "332" "333" "353" "477")) 61 | 62 | ;; logging 63 | (setq erc-log-channels-directory "~/.erc/logs/") 64 | 65 | (if (not (file-exists-p erc-log-channels-directory)) 66 | (mkdir erc-log-channels-directory t)) 67 | 68 | (setq erc-save-buffer-on-part t) 69 | ;; FIXME - this advice is wrong and is causing problems on Emacs exit 70 | ;; (defadvice save-buffers-kill-emacs (before save-logs (arg) activate) 71 | ;; (save-some-buffers t (lambda () (when (eq major-mode 'erc-mode) t)))) 72 | 73 | ;; truncate long irc buffers 74 | (erc-truncate-mode +1) 75 | 76 | ;; enable spell checking 77 | (erc-spelling-mode 1) 78 | ;; set different dictionaries by different servers/channels 79 | ;;(setq erc-spelling-dictionaries '(("#emacs" "american"))) 80 | 81 | ;; TODO - replace this with use of notify.el 82 | ;; Notify my when someone mentions my nick. 83 | (defun call-libnotify (matched-type nick msg) 84 | (let* ((cmsg (split-string (clean-message msg))) 85 | (nick (first (split-string nick "!"))) 86 | (msg (mapconcat 'identity (rest cmsg) " "))) 87 | (shell-command-to-string 88 | (format "notify-send -u critical '%s says:' '%s'" nick msg)))) 89 | 90 | (when (eq system-type 'linux) 91 | (add-hook 'erc-text-matched-hook 'call-libnotify)) 92 | 93 | (defvar erc-notify-nick-alist nil 94 | "Alist of nicks and the last time they tried to trigger a 95 | notification") 96 | 97 | (defvar erc-notify-timeout 10 98 | "Number of seconds that must elapse between notifications from 99 | the same person.") 100 | 101 | (defun erc-notify-allowed-p (nick &optional delay) 102 | "Return non-nil if a notification should be made for NICK. 103 | If DELAY is specified, it will be the minimum time in seconds 104 | that can occur between two notifications. The default is 105 | `erc-notify-timeout'." 106 | (unless delay (setq delay erc-notify-timeout)) 107 | (let ((cur-time (time-to-seconds (current-time))) 108 | (cur-assoc (assoc nick erc-notify-nick-alist)) 109 | (last-time nil)) 110 | (if cur-assoc 111 | (progn 112 | (setq last-time (cdr cur-assoc)) 113 | (setcdr cur-assoc cur-time) 114 | (> (abs (- cur-time last-time)) delay)) 115 | (push (cons nick cur-time) erc-notify-nick-alist) 116 | t))) 117 | 118 | ;; private message notification 119 | (defun erc-notify-on-private-msg (proc parsed) 120 | (let ((nick (car (erc-parse-user (erc-response.sender parsed)))) 121 | (target (car (erc-response.command-args parsed))) 122 | (msg (erc-response.contents parsed))) 123 | (when (and (erc-current-nick-p target) 124 | (not (erc-is-message-ctcp-and-not-action-p msg)) 125 | (erc-notify-allowed-p nick)) 126 | (shell-command-to-string 127 | (format "notify-send -u critical '%s says:' '%s'" nick msg)) 128 | nil))) 129 | 130 | (add-hook 'erc-server-PRIVMSG-functions 'erc-notify-on-private-msg) 131 | 132 | ;; autoaway setup 133 | (setq erc-auto-discard-away t) 134 | (setq erc-autoaway-idle-seconds 600) 135 | (setq erc-autoaway-use-emacs-idle t) 136 | 137 | ;; utf-8 always and forever 138 | (setq erc-server-coding-system '(utf-8 . utf-8)) 139 | 140 | (defun start-irc () 141 | "Connect to IRC." 142 | (interactive) 143 | (when (y-or-n-p "Do you want to start IRC? ") 144 | (erc :server "irc.freenode.net" :port 6667 :nick erc-nick))) 145 | 146 | (defun filter-server-buffers () 147 | (delq nil 148 | (mapcar 149 | (lambda (x) (and (erc-server-buffer-p x) x)) 150 | (buffer-list)))) 151 | 152 | (defun stop-irc () 153 | "Disconnects from all irc servers" 154 | (interactive) 155 | (dolist (buffer (filter-server-buffers)) 156 | (message "Server buffer: %s" (buffer-name buffer)) 157 | (with-current-buffer buffer 158 | (erc-quit-server "Asta la vista")))) 159 | 160 | (provide 'prelude-erc) 161 | 162 | ;;; prelude-erc.el ends here 163 | -------------------------------------------------------------------------------- /utils/installer.sh: -------------------------------------------------------------------------------- 1 | install_prelude () { 2 | printf " Cloning the Prelude's GitHub repository...\n$RESET" 3 | if [ x$PRELUDE_VERBOSE != x ] 4 | then 5 | /usr/bin/env git clone $PRELUDE_URL "$PRELUDE_INSTALL_DIR" 6 | else 7 | /usr/bin/env git clone $PRELUDE_URL "$PRELUDE_INSTALL_DIR" > /dev/null 8 | fi 9 | if ! [ $? -eq 0 ] 10 | then 11 | printf "$RED A fatal error occurred during Prelude's installation. Aborting..." 12 | exit 1 13 | fi 14 | } 15 | 16 | make_prelude_dirs () { 17 | printf " Making the required directories.\n$RESET" 18 | mkdir -p "$PRELUDE_INSTALL_DIR/vendor" "$PRELUDE_INSTALL_DIR/personal" 19 | mkdir -p "$PRELUDE_INSTALL_DIR/themes" 20 | mkdir -p "$PRELUDE_INSTALL_DIR/savefile" 21 | } 22 | 23 | colors () { 24 | # Reset 25 | RESET='\e[0m' 26 | RED='\e[0;31m' # Red 27 | GREEN='\e[0;32m' # Green 28 | YELLOW='\e[0;33m' # Yellow 29 | BLUE='\e[0;34m' # Blue 30 | PURPLE='\e[0;35m' # Purple 31 | CYAN='\e[0;36m' # Cyan 32 | WHITE='\e[0;37m' # White 33 | 34 | # Bold 35 | BRED='\e[1;31m' # Red 36 | BGREEN='\e[1;32m' # Green 37 | BYELLOW='\e[1;33m' # Yellow 38 | BBLUE='\e[1;34m' # Blue 39 | BPURPLE='\e[1;35m' # Purple 40 | BCYAN='\e[1;36m' # Cyan 41 | BWHITE='\e[1;37m' # White 42 | } 43 | 44 | # Commandline args: 45 | # -d/--directory [dir] 46 | # Install prelude into the specified directory. If 'dir' is a relative path prefix it with $HOME. 47 | # Defaults to '$HOME/.emacs.d' 48 | # -c/--colors 49 | # Enable colors 50 | # -s/--source [url] 51 | # Clone prelude from 'url'. 52 | # Defaults to 'https://github.com/bbatsov/prelude.git' 53 | # -i/--into 54 | # If one exists, install into the existing config 55 | # -n/--no-bytecompile 56 | # Skip the compilation of the prelude files. 57 | # -h/--help 58 | # Print help 59 | # -v/--verbose 60 | # Verbose output, for debugging 61 | 62 | usage() { 63 | printf "Usage: $0 [OPTION]\n" 64 | printf " -c, --colors \t \t \t Enable colors.\n" 65 | printf " -d, --directory [dir] \t Install prelude into the specified directory.\n" 66 | printf " \t \t \t \t If 'dir' is a relative path prefix with $HOME.\n" 67 | printf " \t \t \t \t Defaults to $HOME/.emacs.d\n" 68 | printf " -s, --source [url] \t \t Clone prelude from 'url'.\n" 69 | printf " \t \t \t \t Defaults to 'https://github.com/bbatsov/prelude.git'.\n" 70 | printf " -n, --no-bytecompile \t \t Skip the bytecompilation step of prelude.\n" 71 | printf " -i, --into \t \t \t Install Prelude into the existing configuration\n" 72 | printf " \t \t \t \t The default behavious is to install prelude into the existing\n" 73 | printf " \t \t \t \t emacs configuration.\n" 74 | printf " -h, --help \t \t \t Display this help and exit\n" 75 | printf " -v, --verbose \t \t Display verbose information\n" 76 | printf "\n" 77 | } 78 | 79 | ### Parse cli 80 | while [ $# -gt 0 ] 81 | do 82 | case $1 in 83 | -d | --directory) 84 | PRELUDE_INSTALL_DIR=$2 85 | shift 2 86 | ;; 87 | -c | --colors) 88 | colors 89 | shift 1 90 | ;; 91 | -s | --source) 92 | PRELUDE_URL=$2 93 | shift 2 94 | ;; 95 | -i | --into) 96 | PRELUDE_INTO='true' 97 | shift 1 98 | ;; 99 | -n | --no-bytecompile) 100 | PRELUDE_SKIP_BC='true' 101 | shift 1 102 | ;; 103 | -h | --help) 104 | usage 105 | exit 0 106 | ;; 107 | -v | --verbose) 108 | echo "prelude verbose $PRELUDE_VERBOSE" 109 | PRELUDE_VERBOSE='true'; 110 | shift 1 111 | ;; 112 | *) 113 | printf "Unkown option: $1\n" 114 | shift 1 115 | ;; 116 | esac 117 | done 118 | 119 | VERBOSE_COLOR=$BBLUE 120 | 121 | [ -z $PRELUDE_URL ] && PRELUDE_URL="https://github.com/bbatsov/prelude.git" 122 | [ -z "$PRELUDE_INSTALL_DIR" ] && PRELUDE_INSTALL_DIR="$HOME/.emacs.d" 123 | 124 | if [ x$PRELUDE_VERBOSE != x ] 125 | then 126 | printf "$PRELUDE_VERBOSE\n" 127 | printf "$VERBOSE_COLOR" 128 | printf "INSTALL_DIR = $PRELUDE_INSTALL_DIR\n" 129 | printf "SOURCE_URL = $PRELUDE_URL\n" 130 | if [ -n $PRELUDE_SKIP_BC ] 131 | then 132 | printf "Skipping bytecompilation.\n" 133 | fi 134 | if [ -n $PRELUDE_INTO ] 135 | then 136 | printf "Replacing existing config (if one exists).\n" 137 | fi 138 | printf "$RESET" 139 | fi 140 | 141 | # If prelude is already installed 142 | if [ -d "$PRELUDE_INSTALL_DIR/core/prelude-core.el" ] 143 | then 144 | printf "\n\n$BRED" 145 | printf "You already have Prelude installed.$RESET\nYou'll need to remove $PRELUDE_INSTALL_DIR/prelude if you want to install Prelude again.\n" 146 | printf "If you want to update your copy of prelude, run 'git pull origin master' from your prelude directory\n\n" 147 | exit 1; 148 | fi 149 | 150 | ### Check dependencies 151 | printf "$CYAN Checking to see if git is installed... $RESET" 152 | if hash git 2>&- 153 | then 154 | printf "$GREEN found.$RESET\n" 155 | else 156 | printf "$RED not found. Aborting installation!$RESET\n" 157 | exit 1 158 | fi; 159 | 160 | printf "$CYAN Checking to see if aspell is installed... " 161 | if hash aspell 2>&- 162 | then 163 | printf "$GREEN found.$RESET\n" 164 | else 165 | print "$RED not found. Install aspell to benefit from flyspell-mode!$RESET\n" 166 | fi 167 | 168 | printf "$CYAN Checking to see if ack is installed... " 169 | if hash ack 2>&- 170 | then 171 | printf "$GREEN found.$RESET\n" 172 | else 173 | printf "$RED not found. You'll need it to use ack-and-a-half!$RESET\n" 174 | fi 175 | 176 | ### Check emacs version 177 | if [ $(emacs --version 2>/dev/null | sed -n 's/.*[^0-9.]\([0-9]*\.[0-9.]*\).*/\1/p;q' | sed 's/\..*//g') -lt 24 ] 178 | then 179 | printf "$YELLOW WARNING:$RESET Prelude depends on emacs $RED 24$RESET !\n" 180 | fi 181 | 182 | if [ -d "$PRELUDE_INSTALL_DIR" ] || [ -f "$PRELUDE_INSTALL_DIR" ] 183 | then 184 | # Existing file/directory found -> backup 185 | printf " Backing up the existing config to $PRELUDE_INSTALL_DIR.pre-prelude.tar.\n" 186 | tar -cf "$PRELUDE_INSTALL_DIR.pre-prelude.tar" "$PRELUDE_INSTALL_DIR" > /dev/null 2>&1 187 | # Overwrite existing? 188 | if [ -n $PRELUDE_INTO ] 189 | then 190 | # Replace existing config 191 | install_prelude 192 | make_prelude_dirs 193 | else 194 | # Install into existing config 195 | PRELUDE_INSTALL_DIR="$PRELUDE_INSTALL_DIR/prelude" 196 | install_prelude 197 | fi 198 | elif [ -e "$PRELUDE_INSTALL_DIR" ] 199 | then 200 | # File exist but not a regular file or directory 201 | # WTF NOW? 202 | printf "$BRED $PRELUDE_INSTALL_DIR exist but isn't a file or directory.\n" 203 | printf "$BRED please remove this file or install prelude in a different directory" 204 | printf "$BRED (-d flag)\n$RESET" 205 | exit 1 206 | else 207 | # Nothing yet so just install prelude 208 | install_prelude 209 | make_prelude_dirs 210 | cp "$PRELUDE_INSTALL_DIR/sample/prelude-modules.el" "$PRELUDE_INSTALL_DIR" 211 | fi 212 | 213 | if [ -z $PRELUDE_SKIP_BC ]; 214 | then 215 | if which emacs 2>&1 > /dev/null 216 | then 217 | printf " Bytecompiling Prelude.\n" 218 | if [ x$PRELUDE_VERBOSE != x ] 219 | then 220 | emacs -batch -f batch-byte-compile "$PRELUDE_INSTALL_DIR/core/*.el" 221 | else 222 | emacs -batch -f batch-byte-compile "$PRELUDE_INSTALL_DIR/core/*.el" > /dev/null 2>&1 223 | fi 224 | else 225 | printf "$YELLOW Emacs not found.$RESET Skipping bytecompilation.\n" 226 | fi 227 | else 228 | printf "Skipping bytecompilation.\n" 229 | fi 230 | 231 | printf "\n" 232 | printf "$BBLUE ____ _ _ \n" 233 | printf "$BBLUE | _ \ _ __ ___| |_ _ __| | ___ \n" 234 | printf "$BBLUE | |_) | __/ _ \ | | | |/ _ |/ _ \ \n" 235 | printf "$BBLUE | __/| | | __/ | |_| | (_| | __/ \n" 236 | printf "$BBLUE |_| |_| \___|_|\__,_|\__,_|\___| \n\n" 237 | printf "$GREEN ... is now installed and ready to do thy bidding, Master $USER!$RESET\n" 238 | printf "$GREEN Don't forget to adjust the modules you want to use in $PRELUDE_INSTALL_DIR/prelude-modules.el!$RESET\n" 239 | -------------------------------------------------------------------------------- /core/prelude-editor.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-editor.el --- Emacs Prelude: enhanced core editing experience. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Refinements of the core editing experience in Emacs. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | ;; customize 36 | (defgroup prelude nil 37 | "Emacs Prelude configuration." 38 | :prefix "prelude-" 39 | :group 'convenience) 40 | 41 | (defcustom prelude-auto-save t 42 | "Non-nil values enable Prelude's auto save." 43 | :type 'boolean 44 | :group 'prelude) 45 | 46 | (defcustom prelude-guru t 47 | "Non-nil values enable guru-mode." 48 | :type 'boolean 49 | :group 'prelude) 50 | 51 | (defcustom prelude-whitespace t 52 | "Non-nil values enable Prelude's whitespace visualization." 53 | :type 'boolean 54 | :group 'prelude) 55 | 56 | (defcustom prelude-clean-whitespace-on-save t 57 | "Cleanup whitespace from file before it's saved. 58 | Will only occur if prelude-whitespace is also enabled." 59 | :type 'boolean 60 | :group 'prelude) 61 | 62 | (defcustom prelude-flyspell t 63 | "Non-nil values enable Prelude's flyspell support." 64 | :type 'boolean 65 | :group 'prelude) 66 | 67 | ;; Death to the tabs! However, tabs historically indent to the next 68 | ;; 8-character offset; specifying anything else will cause *mass* 69 | ;; confusion, as it will change the appearance of every existing file. 70 | ;; In some cases (python), even worse -- it will change the semantics 71 | ;; (meaning) of the program. 72 | ;; 73 | ;; Emacs modes typically provide a standard means to change the 74 | ;; indentation width -- eg. c-basic-offset: use that to adjust your 75 | ;; personal indentation width, while maintaining the style (and 76 | ;; meaning) of any files you load. 77 | (setq-default indent-tabs-mode nil) ;; don't use tabs to indent 78 | (setq-default tab-width 8) ;; but maintain correct appearance 79 | 80 | ;; delete the selection with a keypress 81 | (delete-selection-mode t) 82 | 83 | ;; store all backup and autosave files in the tmp dir 84 | (setq backup-directory-alist 85 | `((".*" . ,temporary-file-directory))) 86 | (setq auto-save-file-name-transforms 87 | `((".*" ,temporary-file-directory t))) 88 | 89 | ;; revert buffers automatically when underlying files are changed externally 90 | (global-auto-revert-mode t) 91 | 92 | ;; hippie expand is dabbrev expand on steroids 93 | (setq hippie-expand-try-functions-list '(try-expand-dabbrev 94 | try-expand-dabbrev-all-buffers 95 | try-expand-dabbrev-from-kill 96 | try-complete-file-name-partially 97 | try-complete-file-name 98 | try-expand-all-abbrevs 99 | try-expand-list 100 | try-expand-line 101 | try-complete-lisp-symbol-partially 102 | try-complete-lisp-symbol)) 103 | 104 | ;; smart pairing for all 105 | (setq sp-base-key-bindings 'paredit) 106 | (require 'smartparens-config) 107 | (smartparens-global-mode +1) 108 | 109 | ;; diminish keeps the modeline tidy 110 | (require 'diminish) 111 | 112 | ;; meaningful names for buffers with the same name 113 | (require 'uniquify) 114 | (setq uniquify-buffer-name-style 'forward) 115 | (setq uniquify-separator "/") 116 | (setq uniquify-after-kill-buffer-p t) ; rename after killing uniquified 117 | (setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers 118 | 119 | ;; saveplace remembers your location in a file when saving files 120 | (require 'saveplace) 121 | (setq save-place-file (expand-file-name "saveplace" prelude-savefile-dir)) 122 | ;; activate it for all buffers 123 | (setq-default save-place t) 124 | 125 | ;; savehist keeps track of some history 126 | (require 'savehist) 127 | (setq savehist-additional-variables 128 | ;; search entries 129 | '(search ring regexp-search-ring) 130 | ;; save every minute 131 | savehist-autosave-interval 60 132 | ;; keep the home clean 133 | savehist-file (expand-file-name "savehist" prelude-savefile-dir)) 134 | (savehist-mode +1) 135 | 136 | ;; save recent files 137 | (require 'recentf) 138 | (setq recentf-save-file (expand-file-name "recentf" prelude-savefile-dir) 139 | recentf-max-saved-items 200 140 | recentf-max-menu-items 15) 141 | (recentf-mode +1) 142 | 143 | ;; use shift + arrow keys to switch between visible buffers 144 | (require 'windmove) 145 | (windmove-default-keybindings) 146 | 147 | ;; automatically save buffers associated with files on buffer switch 148 | ;; and on windows switch 149 | (defun prelude-auto-save-command () 150 | "Save the current buffer if `prelude-auto-save' is not nil." 151 | (when (and prelude-auto-save 152 | buffer-file-name 153 | (buffer-modified-p (current-buffer)) 154 | (file-writable-p buffer-file-name)) 155 | (save-buffer))) 156 | 157 | (defadvice switch-to-buffer (before save-buffer-now activate) 158 | "Invoke `prelude-auto-save-command' before `switch-to-window'." 159 | (prelude-auto-save-command)) 160 | (defadvice other-window (before other-window-now activate) 161 | "Invoke `prelude-auto-save-command' before `other-window'." 162 | (prelude-auto-save-command)) 163 | (defadvice windmove-up (before other-window-now activate) 164 | "Invoke `prelude-auto-save-command' before `windmove-up'." 165 | (prelude-auto-save-command)) 166 | (defadvice windmove-down (before other-window-now activate) 167 | "Invoke `prelude-auto-save-command' before `windmove-down'." 168 | (prelude-auto-save-command)) 169 | (defadvice windmove-left (before other-window-now activate) 170 | "Invoke `prelude-auto-save-command' before `windmove-left'." 171 | (prelude-auto-save-command)) 172 | (defadvice windmove-right (before other-window-now activate) 173 | "Invoke `prelude-auto-save-command' before `windmove-right'." 174 | (prelude-auto-save-command)) 175 | 176 | (add-hook 'mouse-leave-buffer-hook 'prelude-auto-save-command) 177 | 178 | ;; show-paren-mode: subtle highlighting of matching parens (global-mode) 179 | (require 'paren) 180 | (setq show-paren-style 'parenthesis) 181 | (show-paren-mode +1) 182 | 183 | ;; highlight the current line 184 | (global-hl-line-mode +1) 185 | 186 | (require 'volatile-highlights) 187 | (volatile-highlights-mode t) 188 | (diminish 'volatile-highlights-mode) 189 | 190 | ;; note - this should be after volatile-highlights is required 191 | ;; add the ability to copy and cut the current line, without marking it 192 | (defadvice kill-ring-save (before smart-copy activate compile) 193 | "When called interactively with no active region, copy a single line instead." 194 | (interactive 195 | (if mark-active (list (region-beginning) (region-end)) 196 | (message "Copied line") 197 | (list (line-beginning-position) 198 | (line-beginning-position 2))))) 199 | 200 | (defadvice kill-region (before smart-cut activate compile) 201 | "When called interactively with no active region, kill a single line instead." 202 | (interactive 203 | (if mark-active (list (region-beginning) (region-end)) 204 | (list (line-beginning-position) 205 | (line-beginning-position 2))))) 206 | 207 | ;; tramp, for sudo access 208 | (require 'tramp) 209 | ;; keep in mind known issues with zsh - see emacs wiki 210 | (setq tramp-default-method "ssh") 211 | 212 | ;; ido-mode 213 | (require 'ido) 214 | (require 'ido-ubiquitous) 215 | (setq ido-enable-prefix nil 216 | ido-enable-flex-matching t 217 | ido-create-new-buffer 'always 218 | ido-use-filename-at-point 'guess 219 | ido-max-prospects 10 220 | ido-save-directory-list-file (expand-file-name "ido.hist" prelude-savefile-dir) 221 | ido-default-file-method 'selected-window) 222 | (ido-mode +1) 223 | (ido-ubiquitous +1) 224 | 225 | ;; smex, remember recently and most frequently used commands 226 | (require 'smex) 227 | (setq smex-save-file (expand-file-name ".smex-items" prelude-savefile-dir)) 228 | (smex-initialize) 229 | (global-set-key (kbd "M-x") 'smex) 230 | (global-set-key (kbd "M-X") 'smex-major-mode-commands) 231 | 232 | (set-default 'imenu-auto-rescan t) 233 | 234 | ;; flyspell-mode does spell-checking on the fly as you type 235 | (require 'flyspell) 236 | (setq ispell-program-name "aspell" ; use aspell instead of ispell 237 | ispell-extra-args '("--sug-mode=ultra")) 238 | 239 | (defun prelude-enable-flyspell () 240 | "Enable command `flyspell-mode' if `prelude-flyspell' is not nil." 241 | (when (and prelude-flyspell (executable-find ispell-program-name)) 242 | (flyspell-mode +1))) 243 | 244 | (defun prelude-cleanup-maybe () 245 | "Invoke `whitespace-cleanup' if `prelude-clean-whitespace-on-save' is not nil." 246 | (when prelude-clean-whitespace-on-save 247 | (whitespace-cleanup))) 248 | 249 | (defun prelude-enable-whitespace () 250 | "Enable `whitespace-mode' if `prelude-whitespace' is not nil." 251 | (when prelude-whitespace 252 | ;; keep the whitespace decent all the time (in this buffer) 253 | (add-hook 'before-save-hook 'prelude-cleanup-maybe nil t) 254 | (whitespace-mode +1))) 255 | 256 | (add-hook 'text-mode-hook 'prelude-enable-flyspell) 257 | (add-hook 'text-mode-hook 'prelude-enable-whitespace) 258 | 259 | ;; enable narrowing commands 260 | (put 'narrow-to-region 'disabled nil) 261 | (put 'narrow-to-page 'disabled nil) 262 | (put 'narrow-to-defun 'disabled nil) 263 | 264 | ;; enabled change region case commands 265 | (put 'upcase-region 'disabled nil) 266 | (put 'downcase-region 'disabled nil) 267 | 268 | ;; enable erase-buffer command 269 | (put 'erase-buffer 'disabled nil) 270 | 271 | (require 'expand-region) 272 | 273 | ;; bookmarks 274 | (require 'bookmark) 275 | (setq bookmark-default-file (expand-file-name "bookmarks" prelude-savefile-dir) 276 | bookmark-save-flag 1) 277 | 278 | ;; projectile is a project management mode 279 | (require 'projectile) 280 | (setq projectile-cache-file (expand-file-name "projectile.cache" prelude-savefile-dir)) 281 | (projectile-global-mode t) 282 | (diminish 'projectile-mode "Prjl") 283 | 284 | (require 'helm-misc) 285 | (require 'helm-projectile) 286 | 287 | (defun helm-prelude () 288 | "Preconfigured `helm'." 289 | (interactive) 290 | (condition-case nil 291 | (if (projectile-project-root) 292 | ;; add project files and buffers when in project 293 | (helm-other-buffer '(helm-c-source-projectile-files-list 294 | helm-c-source-projectile-buffers-list 295 | helm-c-source-buffers-list 296 | helm-c-source-recentf 297 | helm-c-source-buffer-not-found) 298 | "*helm prelude*") 299 | ;; otherwise fallback to helm-mini 300 | (helm-mini)) 301 | ;; fall back to helm mini if an error occurs (usually in projectile-project-root) 302 | (error (helm-mini)))) 303 | 304 | ;; shorter aliases for ack-and-a-half commands 305 | (defalias 'ack 'ack-and-a-half) 306 | (defalias 'ack-same 'ack-and-a-half-same) 307 | (defalias 'ack-find-file 'ack-and-a-half-find-file) 308 | (defalias 'ack-find-file-same 'ack-and-a-half-find-file-same) 309 | 310 | ;; dired - reuse current buffer by pressing 'a' 311 | (put 'dired-find-alternate-file 'disabled nil) 312 | 313 | ;; always delete and copy recursively 314 | (setq dired-recursive-deletes 'always) 315 | (setq dired-recursive-copies 'always) 316 | 317 | ;; if there is a dired buffer displayed in the next window, use its 318 | ;; current subdir, instead of the current subdir of this dired buffer 319 | (setq dired-dwim-target t) 320 | 321 | ;; enable some really cool extensions like C-x C-j(dired-jump) 322 | (require 'dired-x) 323 | 324 | ;; ediff - don't start another frame 325 | (require 'ediff) 326 | (setq ediff-window-setup-function 'ediff-setup-windows-plain) 327 | 328 | ;; clean up obsolete buffers automatically 329 | (require 'midnight) 330 | 331 | ;; automatically indenting yanked text if in programming-modes 332 | (defvar yank-indent-modes 333 | '(LaTeX-mode TeX-mode) 334 | "Modes in which to indent regions that are yanked (or yank-popped). 335 | Only modes that don't derive from `prog-mode' should be listed here.") 336 | 337 | (defvar yank-indent-blacklisted-modes 338 | '(python-mode slim-mode haml-mode) 339 | "Modes for which auto-indenting is suppressed.") 340 | 341 | (defvar yank-advised-indent-threshold 1000 342 | "Threshold (# chars) over which indentation does not automatically occur.") 343 | 344 | (defun yank-advised-indent-function (beg end) 345 | "Do indentation, as long as the region isn't too large." 346 | (if (<= (- end beg) yank-advised-indent-threshold) 347 | (indent-region beg end nil))) 348 | 349 | (defadvice yank (after yank-indent activate) 350 | "If current mode is one of 'yank-indent-modes, 351 | indent yanked text (with prefix arg don't indent)." 352 | (if (and (not (ad-get-arg 0)) 353 | (not (member major-mode yank-indent-blacklisted-modes)) 354 | (or (derived-mode-p 'prog-mode) 355 | (member major-mode yank-indent-modes))) 356 | (let ((transient-mark-mode nil)) 357 | (yank-advised-indent-function (region-beginning) (region-end))))) 358 | 359 | (defadvice yank-pop (after yank-pop-indent activate) 360 | "If current mode is one of 'yank-indent-modes, 361 | indent yanked text (with prefix arg don't indent)." 362 | (if (and (not (ad-get-arg 0)) 363 | (not (member major-mode yank-indent-blacklisted-modes)) 364 | (or (derived-mode-p 'prog-mode) 365 | (member major-mode yank-indent-modes))) 366 | (let ((transient-mark-mode nil)) 367 | (yank-advised-indent-function (region-beginning) (region-end))))) 368 | 369 | ;; abbrev config 370 | (add-hook 'text-mode-hook 'abbrev-mode) 371 | 372 | ;; make a shell script executable automatically on save 373 | (add-hook 'after-save-hook 374 | 'executable-make-buffer-file-executable-if-script-p) 375 | 376 | ;; .zsh file is shell script too 377 | (add-to-list 'auto-mode-alist '("\\.zsh\\'" . shell-script-mode)) 378 | 379 | ;; whitespace-mode config 380 | (require 'whitespace) 381 | (setq whitespace-line-column 80) ;; limit line length 382 | (setq whitespace-style '(face tabs empty trailing lines-tail)) 383 | 384 | ;; saner regex syntax 385 | (require 're-builder) 386 | (setq reb-re-syntax 'string) 387 | 388 | (require 'eshell) 389 | (setq eshell-directory-name (expand-file-name "eshell" prelude-savefile-dir)) 390 | 391 | (setq semanticdb-default-save-directory 392 | (expand-file-name "semanticdb" prelude-savefile-dir)) 393 | 394 | ;; enable Prelude's keybindings 395 | (prelude-global-mode t) 396 | 397 | ;; sensible undo 398 | (global-undo-tree-mode) 399 | (diminish 'undo-tree-mode) 400 | 401 | ;; enable winner-mode to manage window configurations 402 | (winner-mode +1) 403 | 404 | (provide 'prelude-editor) 405 | 406 | ;;; prelude-editor.el ends here 407 | -------------------------------------------------------------------------------- /core/prelude-core.el: -------------------------------------------------------------------------------- 1 | ;;; prelude-core.el --- Emacs Prelude: Core Prelude functions. 2 | ;; 3 | ;; Copyright © 2011-2013 Bozhidar Batsov 4 | ;; 5 | ;; Author: Bozhidar Batsov 6 | ;; URL: https://github.com/bbatsov/prelude 7 | ;; Version: 1.0.0 8 | ;; Keywords: convenience 9 | 10 | ;; This file is not part of GNU Emacs. 11 | 12 | ;;; Commentary: 13 | 14 | ;; Here are the definitions of most of the functions added by Prelude. 15 | 16 | ;;; License: 17 | 18 | ;; This program is free software; you can redistribute it and/or 19 | ;; modify it under the terms of the GNU General Public License 20 | ;; as published by the Free Software Foundation; either version 3 21 | ;; of the License, or (at your option) any later version. 22 | ;; 23 | ;; This program is distributed in the hope that it will be useful, 24 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | ;; GNU General Public License for more details. 27 | ;; 28 | ;; You should have received a copy of the GNU General Public License 29 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 30 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 31 | ;; Boston, MA 02110-1301, USA. 32 | 33 | ;;; Code: 34 | 35 | (require 'thingatpt) 36 | (require 'dash) 37 | 38 | (defun prelude-open-with (arg) 39 | "Open visited file in default external program. 40 | 41 | With a prefix ARG always prompt for command to use." 42 | (interactive "P") 43 | (when buffer-file-name 44 | (shell-command (concat 45 | (cond 46 | ((and (not arg) (eq system-type 'darwin)) "open") 47 | ((and (not arg) (member system-type '(gnu gnu/linux gnu/kfreebsd))) "xdg-open") 48 | (t (read-shell-command "Open current file with: "))) 49 | " " 50 | (shell-quote-argument buffer-file-name))))) 51 | 52 | (defun prelude-buffer-mode (buffer-or-name) 53 | "Retrieve the `major-mode' of BUFFER-OR-NAME." 54 | (with-current-buffer buffer-or-name 55 | major-mode)) 56 | 57 | (defun prelude-visit-term-buffer () 58 | "Create or visit a terminal buffer." 59 | (interactive) 60 | (prelude-start-or-switch-to (lambda () 61 | (ansi-term (getenv "SHELL"))) 62 | "*ansi-term*")) 63 | 64 | (defun prelude-google () 65 | "Googles a query or region if any." 66 | (interactive) 67 | (browse-url 68 | (concat 69 | "http://www.google.com/search?ie=utf-8&oe=utf-8&q=" 70 | (url-hexify-string (if mark-active 71 | (buffer-substring (region-beginning) (region-end)) 72 | (read-string "Google: ")))))) 73 | 74 | (defun prelude-indent-rigidly-and-copy-to-clipboard (begin end arg) 75 | "Indent region between BEGIN and END by ARG columns and copy to clipboard." 76 | (interactive "r\nP") 77 | (let ((arg (or arg 4)) 78 | (buffer (current-buffer))) 79 | (with-temp-buffer 80 | (insert-buffer-substring-no-properties buffer begin end) 81 | (indent-rigidly (point-min) (point-max) arg) 82 | (clipboard-kill-ring-save (point-min) (point-max))))) 83 | 84 | (defun prelude-smart-open-line-above () 85 | "Insert an empty line above the current line. 86 | Position the cursor at it's beginning, according to the current mode." 87 | (interactive) 88 | (move-beginning-of-line nil) 89 | (newline-and-indent) 90 | (forward-line -1) 91 | (indent-according-to-mode)) 92 | 93 | (defun prelude-smart-open-line (arg) 94 | "Insert an empty line after the current line. 95 | Position the cursor at its beginning, according to the current mode. 96 | 97 | With a prefix ARG open line above the current line." 98 | (interactive "P") 99 | (if arg 100 | (prelude-smart-open-line-above) 101 | (progn 102 | (move-end-of-line nil) 103 | (newline-and-indent)))) 104 | 105 | (defun prelude-top-join-line () 106 | "Join the current line with the line beneath it." 107 | (interactive) 108 | (delete-indentation 1)) 109 | 110 | (defun prelude-move-line-up () 111 | "Move the current line up." 112 | (interactive) 113 | (transpose-lines 1) 114 | (forward-line -2) 115 | (indent-according-to-mode)) 116 | 117 | (defun prelude-move-line-down () 118 | "Move the current line down." 119 | (interactive) 120 | (forward-line 1) 121 | (transpose-lines 1) 122 | (forward-line -1) 123 | (indent-according-to-mode)) 124 | 125 | (defun prelude-kill-whole-line (&optional arg) 126 | "A simple wrapper around command `kill-whole-line' that respects indentation. 127 | Passes ARG to command `kill-whole-line' when provided." 128 | (interactive "P") 129 | (kill-whole-line arg) 130 | (back-to-indentation)) 131 | 132 | (defun prelude-move-beginning-of-line (arg) 133 | "Move point back to indentation of beginning of line. 134 | 135 | Move point to the first non-whitespace character on this line. 136 | If point is already there, move to the beginning of the line. 137 | Effectively toggle between the first non-whitespace character and 138 | the beginning of the line. 139 | 140 | If ARG is not nil or 1, move forward ARG - 1 lines first. If 141 | point reaches the beginning or end of the buffer, stop there." 142 | (interactive "^p") 143 | (setq arg (or arg 1)) 144 | 145 | ;; Move lines first 146 | (when (/= arg 1) 147 | (let ((line-move-visual nil)) 148 | (forward-line (1- arg)))) 149 | 150 | (let ((orig-point (point))) 151 | (back-to-indentation) 152 | (when (= orig-point (point)) 153 | (move-beginning-of-line 1)))) 154 | 155 | (global-set-key [remap move-beginning-of-line] 156 | 'prelude-move-beginning-of-line) 157 | 158 | (defun prelude-indent-buffer () 159 | "Indent the currently visited buffer." 160 | (interactive) 161 | (indent-region (point-min) (point-max))) 162 | 163 | (defun prelude-indent-region-or-buffer () 164 | "Indent a region if selected, otherwise the whole buffer." 165 | (interactive) 166 | (save-excursion 167 | (if (region-active-p) 168 | (progn 169 | (indent-region (region-beginning) (region-end)) 170 | (message "Indented selected region.")) 171 | (progn 172 | (prelude-indent-buffer) 173 | (message "Indented buffer."))))) 174 | 175 | (defun prelude-indent-defun () 176 | "Indent the current defun." 177 | (interactive) 178 | (save-excursion 179 | (mark-defun) 180 | (indent-region (region-beginning) (region-end)))) 181 | 182 | (defun prelude-annotate-todo () 183 | "Put fringe marker on TODO: lines in the curent buffer." 184 | (interactive) 185 | (save-excursion 186 | (goto-char (point-min)) 187 | (while (re-search-forward "TODO:" nil t) 188 | (let ((overlay (make-overlay (- (point) 5) (point)))) 189 | (overlay-put overlay 190 | 'before-string 191 | (propertize (format "A") 192 | 'display '(left-fringe right-triangle))))))) 193 | 194 | (defun prelude-copy-file-name-to-clipboard () 195 | "Copy the current buffer file name to the clipboard." 196 | (interactive) 197 | (let ((filename (if (equal major-mode 'dired-mode) 198 | default-directory 199 | (buffer-file-name)))) 200 | (when filename 201 | (kill-new filename) 202 | (message "Copied buffer file name '%s' to the clipboard." filename)))) 203 | 204 | (defun prelude-duplicate-current-line-or-region (arg) 205 | "Duplicates the current line or region ARG times. 206 | If there's no region, the current line will be duplicated. However, if 207 | there's a region, all lines that region covers will be duplicated." 208 | (interactive "p") 209 | (let (beg end (origin (point))) 210 | (if (and mark-active (> (point) (mark))) 211 | (exchange-point-and-mark)) 212 | (setq beg (line-beginning-position)) 213 | (if mark-active 214 | (exchange-point-and-mark)) 215 | (setq end (line-end-position)) 216 | (let ((region (buffer-substring-no-properties beg end))) 217 | (-dotimes arg 218 | (lambda (n) 219 | (goto-char end) 220 | (newline) 221 | (insert region) 222 | (setq end (point)))) 223 | (goto-char (+ origin (* (length region) arg) arg))))) 224 | 225 | (defun prelude-rename-file-and-buffer () 226 | "Renames current buffer and file it is visiting." 227 | (interactive) 228 | (let ((filename (buffer-file-name))) 229 | (if (not (and filename (file-exists-p filename))) 230 | (message "Buffer is not visiting a file!") 231 | (let ((new-name (read-file-name "New name: " filename))) 232 | (cond 233 | ((vc-backend filename) (vc-rename-file filename new-name)) 234 | (t 235 | (rename-file filename new-name t) 236 | (set-visited-file-name new-name t t))))))) 237 | 238 | (defun prelude-delete-file-and-buffer () 239 | "Kill the current buffer and deletes the file it is visiting." 240 | (interactive) 241 | (let ((filename (buffer-file-name))) 242 | (when filename 243 | (if (vc-backend filename) 244 | (vc-delete-file filename) 245 | (progn 246 | (delete-file filename) 247 | (message "Deleted file %s" filename) 248 | (kill-buffer)))))) 249 | 250 | (defun prelude-view-url () 251 | "Open a new buffer containing the contents of URL." 252 | (interactive) 253 | (let* ((default (thing-at-point-url-at-point)) 254 | (url (read-from-minibuffer "URL: " default))) 255 | (switch-to-buffer (url-retrieve-synchronously url)) 256 | (rename-buffer url t) 257 | (cond ((search-forward "> (buffer-list) 369 | (-filter #'buffer-file-name) 370 | (--remove (eql (current-buffer) it))) 371 | #'kill-buffer)) 372 | 373 | (defun prelude-create-scratch-buffer () 374 | "Create a new scratch buffer." 375 | (interactive) 376 | (progn 377 | (switch-to-buffer 378 | (get-buffer-create (generate-new-buffer-name "*scratch*"))) 379 | (emacs-lisp-mode))) 380 | 381 | (defvar prelude-tips 382 | '("Press to open a file with external program." 383 | "Press to navigate a project's files with ido." 384 | "Press to navigate a project in Helm." 385 | "Press to search in Google." 386 | "Press to rename the current buffer and file it's visiting." 387 | "Press to open a terminal in Emacs." 388 | "Explore the Prelude menu to find out about some of Prelude extensions to Emacs." 389 | "Access the official Emacs manual by pressing ." 390 | "Visit WikEmacs at http://wikemacs.org to find out even more about Emacs.")) 391 | 392 | (defun prelude-tip-of-the-day () 393 | "Display a random entry from `prelude-tips'." 394 | (interactive) 395 | (unless (window-minibuffer-p) 396 | ;; pick a new random seed 397 | (random t) 398 | (message 399 | (concat "Prelude tip: " (nth (random (length prelude-tips)) prelude-tips))))) 400 | 401 | (defun prelude-eval-after-init (form) 402 | "Add `(lambda () FORM)' to `after-init-hook'. 403 | 404 | If Emacs has already finished initialization, also eval FORM immediately." 405 | (let ((func (list 'lambda nil form))) 406 | (add-hook 'after-init-hook func) 407 | (when after-init-time 408 | (eval form)))) 409 | 410 | (defun prelude-exchange-point-and-mark () 411 | "Identical to `exchange-point-and-mark' but will not activate the region." 412 | (interactive) 413 | (exchange-point-and-mark) 414 | (deactivate-mark nil)) 415 | 416 | (defun prelude-update () 417 | "Update Prelude to its latest version." 418 | (interactive) 419 | (when (y-or-n-p "Do you want to update Prelude? ") 420 | (message "Updating Prelude...") 421 | (cd prelude-dir) 422 | (shell-command "git pull") 423 | (prelude-recompile-init) 424 | (message "Update finished. Restart Emacs to complete the process."))) 425 | 426 | (provide 'prelude-core) 427 | ;;; prelude-core.el ends here 428 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Emacs Prelude 2 | ============= 3 | 4 | Prelude is an Emacs distribution that aims to enhance the default 5 | Emacs experience. Prelude alters a lot of the default settings, 6 | bundles a plethora of additional packages and adds its own core 7 | library to the mix. The final product offers an easy to use Emacs 8 | configuration for Emacs newcomers and lots of additional power for 9 | Emacs power users. 10 | 11 | Prelude is compatible **ONLY with GNU Emacs 24.x**. In general you're 12 | advised to always run Prelude with the latest Emacs - currently 13 | **24.3**. 14 | 15 | ## Fast Forward 16 | 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 | 22 | ```bash 23 | curl -L http://git.io/epre | sh 24 | ``` 25 | 26 | You can now power up your Emacs, sit back and enjoy Prelude, 27 | forgetting about the rest of this manual. 28 | 29 | There are two environment variables you can use to control the 30 | source repository and the installation directory. To change the 31 | installation directory: 32 | 33 | ```bash 34 | export PRELUDE_INSTALL_DIR="$HOME/.emacs.d" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh 35 | ``` 36 | 37 | To change the source repository: 38 | 39 | ```bash 40 | export PRELUDE_URL="https://github.com/yourname/prelude.git" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh 41 | ``` 42 | 43 | Note that the installer will back up any existing `.emacs` file or 44 | `.emacs.d` since it will unpack Prelude's code in `.emacs.d`. If 45 | you're doing a manual install make sure you don't have a `.emacs` file 46 | or back up your existing `.emacs.d` directory manually. 47 | 48 | Don't forget to adjust your `prelude-modules.el` file once the installation is done. 49 | By default most of the modules that ship with Prelude are not loaded. 50 | 51 | ## Installing Emacs 24 52 | 53 | Obviously to use the Emacs Prelude you have to install Emacs 24 54 | first. Have a look at the [WikEmacs articles on installing Emacs](http://wikemacs.org/wiki/Installing_Emacs). 55 | 56 | ## Installation 57 | 58 | ### Automated 59 | 60 | You can install **Emacs Prelude** via the command line with either `curl` or 61 | `wget`. Naturally `git` is also required. 62 | 63 | #### Via Curl 64 | 65 | If you're using `curl` type the following command: 66 | 67 | ```bash 68 | curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh 69 | ``` 70 | 71 | #### Via Wget 72 | 73 | If you're using `wget` type: 74 | 75 | ```bash 76 | wget --no-check-certificate https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O - | sh 77 | ``` 78 | 79 | ### Manual 80 | 81 | ```bash 82 | git clone git://github.com/bbatsov/prelude.git path/to/local/repo 83 | ln -s path/to/local/repo ~/.emacs.d 84 | cd ~/.emacs.d 85 | ``` 86 | 87 | You'd do well to replace `~/.emacs.d` with the value of 88 | `user-emacs-directory` for your OS. You can check the value by doing 89 | `C-h v user-emacs-directory` inside Emacs. 90 | 91 | ## Updating Prelude 92 | 93 | The update procedure is fairly straightforward: 94 | 95 | ```bash 96 | cd path/to/prelude/installation 97 | git pull 98 | ``` 99 | 100 | The `path/to/prelude/installation` is usually `~/.emacs.d` (at least 101 | on Unix systems). 102 | 103 | Alternatively you can run M-x prelude-update from Emacs itself. 104 | 105 | It's generally a good idea to stop Emacs before you do the update. The 106 | next time Prelude starts it will install any new dependencies (if 107 | there are such). 108 | 109 | ## Enabling additional modules 110 | 111 | By default most of the modules that ship with Prelude are not loaded. 112 | 113 | ```lisp 114 | ;;; Uncomment the modules you'd like to use and restart Prelude afterwards 115 | 116 | (require 'prelude-c) 117 | ;; (require 'prelude-clojure) 118 | ;; (require 'prelude-coffee) 119 | ;; (require 'prelude-common-lisp) 120 | ;; (require 'prelude-css) 121 | (require 'prelude-emacs-lisp) 122 | (require 'prelude-erc) 123 | ;; (require 'prelude-erlang) 124 | ;; (require 'prelude-haskell) 125 | (require 'prelude-js) 126 | ;; (require 'prelude-latex) 127 | (require 'prelude-lisp) 128 | ;; (require 'prelude-markdown) 129 | ;; (require 'prelude-mediawiki) 130 | (require 'prelude-org) 131 | (require 'prelude-perl) 132 | ;; (require 'prelude-python) 133 | ;; (require 'prelude-ruby) 134 | ;; (require 'prelude-scala) 135 | (require 'prelude-scheme) 136 | ;; (require 'prelude-scss) 137 | (require 'prelude-xml) 138 | ``` 139 | 140 | You'll need to adjust your `prelude-modules.el` file once the 141 | installation is done. If you are doing a manual install then you first 142 | need to copy the `prelude-modules.el` available in the sample 143 | directory to the root of `path/to/prelude/installation` and then 144 | adjust that one. 145 | 146 | After you've uncommented a module you should either restart Emacs or evaluate the module 147 | `require` expression with C-x C-e. 148 | 149 | ## Running 150 | 151 | Nothing fancy here. Just start Emacs as usual. Personally I run Emacs 152 | in daemon mode: 153 | 154 | ```bash 155 | emacs --daemon 156 | ``` 157 | 158 | Afterwards I connect to the server with either a terminal or a GUI 159 | client like this: 160 | 161 | ```bash 162 | emacsclient -t 163 | emacsclient -c 164 | ``` 165 | 166 | You'd probably do well to put a few aliases in your `.zshrc` (or 167 | `.bashrc`): 168 | 169 | ```bash 170 | alias e=emacsclient -t 171 | alias ec=emacsclient -c 172 | alias vim=emacsclient -t 173 | alias vi=emacsclient -t 174 | ``` 175 | 176 | The last two aliases are helpful if you're used to editing files from 177 | the command line using `vi(m)`. 178 | 179 | ## Getting to know Prelude 180 | 181 | Certainly the best way to understand how Prelude enhances the default 182 | Emacs experience is to peruse Prelude's source code (which is 183 | obviously written in Emacs Lisp). Understanding the code is not 184 | necessary of course. Prelude includes a `prelude-mode` minor Emacs mode 185 | which collects some of the additional functionality added by 186 | Prelude. It also adds an additional keymap that binds many of those 187 | extensions to keybindings. 188 | 189 | ### Keymap 190 | 191 | #### Global 192 | 193 | Keybinding | Description 194 | -------------------|------------------------------------------------------------ 195 | C-M-h | Kill the previous word(`backward-kill-word`). (as in Bash/Zsh) 196 | C-x \\ | `align-regexp` 197 | C-+ | Increase font size(`text-scale-increase`). 198 | C-- | Decrease font size(`text-scale-decrease`). 199 | C-x O | Go back to previous window (the inverse of `other-window` (`C-x o`)). 200 | C-^ | Join two lines into one(`prelude-top-join-line`). 201 | C-x p | Start `proced` (manage processes from Emacs; works only in Linux). 202 | C-x m | Start `eshell`. 203 | C-x M-m | Start your default shell. 204 | C-x C-m | Alias for `M-x`. 205 | C-h A | Run `apropos` (search in all Emacs symbols). 206 | M-/ | Run `hippie-expand` (a replacement for the default `dabbrev-expand`). 207 | C-x C-b | Open `ibuffer` (a replacement for the default `buffer-list`). 208 | F12 | Toggle the Emacs menu bar. 209 | C-x g | Open Magit's status buffer. 210 | C-= | Run `expand-region` (incremental text selection). 211 | C-a | Run `prelude-move-beginning-of-line`. Read [this](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/) for details. 212 | 213 | #### Prelude Mode 214 | 215 | Keybinding | Description 216 | -------------------|------------------------------------------------------------ 217 | C-c o | Open the currently visited file with an external program. 218 | C-c g | Search in Google for the thing under point (or an interactive query). 219 | C-S-RET or M-o | Insert an empty line above the current line and indent it properly 220 | S-RET or M-O | Insert an empty line and indent it properly (as in most IDEs). 221 | C-S-up | Move the current line up. 222 | C-S-down | Move the current line down. 223 | C-c n | Fix indentation in buffer and strip whitespace. 224 | C-c f | Open recently visited file. 225 | C-M-\\ | Indent region (if selected) or the entire buffer. 226 | C-c u | Open URL in your default browser. 227 | C-c e | Eval a bit of Emacs Lisp code and replace it with its result. 228 | C-c s | Swap two active windows. 229 | C-c d | Duplicate the current line (or region). 230 | C-c r | Rename the currently visited file and buffer. 231 | C-c t | Open a terminal emulator (`ansi-term`). 232 | C-c k | Kill all open buffers except the one you're currently in. 233 | C-c h | Open Helm (a useful means of navigating your buffers and project files). 234 | 235 | #### Projectile 236 | 237 | Here's a list of functionality provided by [Projectile](https://github.com/bbatsov/projectile): 238 | 239 | Keybinding | Description 240 | -------------------|------------------------------------------------------------ 241 | C-c p f | Display a list of all files in the project. With a prefix argument it will clear the cache first. 242 | C-c p d | Display a list of all directories in the project. With a prefix argument it will clear the cache first. 243 | C-c p T | Display a list of all test files(specs, features, etc) in the project. 244 | C-c p g | Run grep on the files in the project. 245 | C-c p b | Display a list of all project buffers currently open. 246 | C-c p o | Runs `multi-occur` on all project buffers currently open. 247 | C-c p r | Runs interactive query-replace on all files in the projects. 248 | C-c p i | Invalidates the project cache (if existing). 249 | C-c p R | Regenerates the projects `TAGS` file. 250 | C-c p k | Kills all project buffers. 251 | C-c p D | Opens the root of the project in `dired`. 252 | C-c p e | Shows a list of recently visited project files. 253 | C-c p a | Runs `ack` on the project. Requires the presence of `ack-and-a-half`. 254 | C-c p c | Runs a standard compilation command for your type of project. 255 | C-c p p | Runs a standard test command for your type of project. 256 | C-c p z | Adds the currently visited to the cache. 257 | C-c p s | Display a list of known projects you can switch to. 258 | 259 | If you ever forget any of Projectile's keybindings just do a: 260 | 261 | C-c p C-h 262 | 263 | #### Key-chords 264 | 265 | Keybinding | Description 266 | -------------------|---------------------------------------------- 267 | jj | Jump to the beginning of a word(`ace-jump-word-mode`) 268 | jk | Jump to a character(`ace-jump-char-mode`) 269 | jl | Jump to the beginning of a line(`ace-jump-line-mode`) 270 | JJ | Jump back to previous buffer(`prelude-switch-to-previous-buffer`) 271 | uu | View edits as a tree(`undo-tree-visualize`) 272 | 273 | ##### Disabling key-chords 274 | 275 | In some cases you may not want to have a key-chord that is defined by prelude, 276 | in which case you can disable the binding in your `personal.el` file by setting 277 | its command to `nil`. For example, to disable the `jj` key-chord add the 278 | following line: 279 | 280 | ```lisp 281 | (key-chord-define-global "jj" nil) 282 | ``` 283 | 284 | If you're an `evil-mode` user you'll probably do well to disable `key-chord-mode` altogether: 285 | 286 | ```lisp 287 | (key-chord-mode -1) 288 | ``` 289 | 290 | ## Automatic package installation 291 | 292 | The default Prelude installation comes with a bare minimum of 293 | functionality. It will however install add-ons for various programming 294 | languages and frameworks on demand. For instance - if you try to open 295 | a `.clj` file `clojure-mode`, `nrepl.el` and prelude's enhanced Lisp 296 | configuration will be installed automatically for you. 297 | 298 | You can, of course, install anything you wish manually as well. 299 | 300 | ### Color Themes 301 | 302 | Emacs 24 ships with a new theming facility that effectively renders 303 | the old color-theme package obsolete. Emacs 24 provides a dozen of 304 | built-in themes you can use out-of-the-box by invoking the `M-x 305 | load-theme` command. 306 | 307 | [Zenburn](https://github.com/bbatsov/zenburn-emacs) is the default color theme in Prelude, but you can change it 308 | at your discretion. Why Zenburn? I (and lots of hackers around the 309 | world) find it pretty neat for some reason. Personally I find the 310 | default theme pretty tiresome for the eyes, that's why I took that 311 | "controversial" decision to replace it. You can, of course, easily go 312 | back to the default (or select another theme entirely). 313 | 314 | To disable Zenburn just put in your personal config the following 315 | line: 316 | 317 | ```lisp 318 | (disable-theme 'zenburn) 319 | ``` 320 | 321 | Or you can use another theme altogether by adding something like: 322 | 323 | ```lisp 324 | (load-theme 'solarized-dark t) 325 | ``` 326 | 327 | P.S. Solarized is not available by default - you'll have to install it from MELPA first. 328 | 329 | ### Personalizing 330 | 331 | Fork the official Prelude repo and add your own touch to it. You're advised to avoid changing stuff outside of the 332 | personal folder to avoid having to deal with git merge conflicts in the future. 333 | 334 | If you'd like to add some auto installation of packages in your 335 | personal config use the following code: 336 | 337 | ```lisp 338 | (prelude-ensure-module-deps '(some-package some-other-package)) 339 | ``` 340 | 341 | #### Disabling whitespace-mode 342 | 343 | Although `whitespace-mode` is awesome some people might find it too 344 | intrusive. You can disable it in your 345 | personal config with the following bit of code: 346 | 347 | ```lisp 348 | (setq prelude-whitespace nil) 349 | ``` 350 | 351 | If you like `whitespace-mode` but prefer it to not automatically 352 | cleanup your file on save, you can disable that behavior by setting 353 | prelude-clean-whitespace-on-save to nil in your config file with: 354 | 355 | ```lisp 356 | (setq prelude-clean-whitespace-on-save nil) 357 | ``` 358 | 359 | The prelude-clean-whitespace-on-save setting can also be set on a 360 | per-file or directory basis by using a file variable or a 361 | .dir-locals.el file. 362 | 363 | 364 | #### Disable flyspell-mode 365 | 366 | If you're not fond of spellchecking on the fly: 367 | 368 | ```lisp 369 | (setq prelude-flyspell nil) 370 | ``` 371 | 372 | ## Caveats & Pitfalls 373 | 374 | ### Problems with flyspell-mode 375 | 376 | Prelude makes heavy use of the flyspell-mode package for spell 377 | checking of various things. The proper operation of flyspell depends 378 | on the presence of the `aspell` program and an `en` dictionary on your 379 | system. You can install `aspell` and the dictionary on OS X with 380 | `homebrew` like this: 381 | 382 | ```bash 383 | brew install aspell --with-lang=en 384 | ``` 385 | 386 | On Linux distros - just use your distro's package manager. 387 | 388 | ### Ugly colors in the terminal Emacs version 389 | 390 | If your Emacs looks considerably uglier in a terminal (compared to the 391 | GUI version) try adding this to your `.bashrc` or `.zshrc`: 392 | 393 | ```bash 394 | export TERM=xterm-256color 395 | ``` 396 | 397 | Source the `.bashrc` file and start Emacs again. 398 | 399 | ### MELPA error on initial startup 400 | 401 | If you get some http connection error related to the MELPA repo 402 | just do a manual `M-x package-refresh-contents` and restart Emacs 403 | afterwards. 404 | 405 | ### No arrow navigation in editor buffers 406 | 407 | This is not a bug - it's a feature! I firmly believe that the one true 408 | way to use Emacs is by using it the way it was intended to be used (as 409 | far as navigation is concerned at least). That's why I've disabled all 410 | movement commands with arrows (and keys like page up, page down, etc) - to prevent you from being tempted to 411 | use them. 412 | 413 | If you'd still like to use the arrow keys just invoke `M-x 414 | guru-mode` to enable them for the duration of your 415 | current Emacs session or add the following snippet to your 416 | personal Emacs customization to enable them permanently: 417 | 418 | ```lisp 419 | (setq prelude-guru nil) 420 | ``` 421 | 422 | ### Customized C-a behavior 423 | 424 | Prelude overrides `C-a` to behave as described 425 | [here](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/). If 426 | you don't like that simply add this to your personal config: 427 | 428 | ```lisp 429 | (global-set-key [remap move-beginning-of-line] 430 | 'move-beginning-of-line) 431 | ``` 432 | 433 | ### Windows compatibility 434 | 435 | While everything in Prelude should work fine in Windows, I test it only 436 | with Linux & OSX, so there are Windows related problems from time to 437 | time. This situation will probably improve over time. 438 | 439 | ## Share the knowledge 440 | 441 | [WikEmacs](http://wikemacs.org) collects useful resources for working 442 | with GNU Emacs. Please, take the time to peruse and improve them as 443 | you accumulate knowledge about Emacs. Prelude makes this especially 444 | easy, since it bundles 445 | [MediaWiki support](http://wikemacs.org/wiki/Mediawiki.el) + the 446 | settings required to access WikEmacs right away. 447 | 448 | ## Known issues 449 | 450 | Check out the project's 451 | [issue list](https://github.com/bbatsov/prelude/issues?sort=created&direction=desc&state=open) 452 | a list of unresolved issues. By the way - feel free to fix any of them 453 | and send me a pull request. :-) 454 | 455 | ## Support 456 | 457 | Support is available via the Prelude Google Group . 458 | 459 | ## Contributors 460 | 461 | Here's a [list](https://github.com/bbatsov/prelude/contributors) of all the people who have contributed to the 462 | development of Emacs Prelude. 463 | 464 | ## Bugs & Improvements 465 | 466 | Bug reports and suggestions for improvements are always 467 | welcome. GitHub pull requests are even better! :-) 468 | 469 | Cheers,
470 | [Bozhidar](https://twitter.com/bbatsov) 471 | --------------------------------------------------------------------------------